xdataapi 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xdataapi/__init__.py +8 -0
- xdataapi/api/__init__.py +1 -0
- xdataapi/api/account/__init__.py +1 -0
- xdataapi/api/account/get_me.py +144 -0
- xdataapi/api/billing/__init__.py +1 -0
- xdataapi/api/billing/create_checkout.py +206 -0
- xdataapi/api/billing/list_packs.py +144 -0
- xdataapi/api/tweets/__init__.py +1 -0
- xdataapi/api/tweets/get_quotes.py +241 -0
- xdataapi/api/tweets/get_replies.py +230 -0
- xdataapi/api/tweets/get_retweeters.py +245 -0
- xdataapi/api/tweets/get_thread.py +226 -0
- xdataapi/api/tweets/get_tweet.py +213 -0
- xdataapi/api/tweets/get_tweets.py +223 -0
- xdataapi/api/tweets/search_tweets.py +277 -0
- xdataapi/api/users/__init__.py +1 -0
- xdataapi/api/users/get_follower_ids.py +254 -0
- xdataapi/api/users/get_followers.py +254 -0
- xdataapi/api/users/get_following.py +246 -0
- xdataapi/api/users/get_user.py +213 -0
- xdataapi/api/users/get_user_tweets.py +241 -0
- xdataapi/api/users/get_users.py +231 -0
- xdataapi/client.py +268 -0
- xdataapi/errors.py +16 -0
- xdataapi/models/__init__.py +67 -0
- xdataapi/models/batch_error.py +79 -0
- xdataapi/models/batch_error_code.py +15 -0
- xdataapi/models/batch_meta.py +126 -0
- xdataapi/models/batch_meta_cache.py +11 -0
- xdataapi/models/create_checkout_body.py +63 -0
- xdataapi/models/create_checkout_body_pack.py +11 -0
- xdataapi/models/create_checkout_response_200.py +97 -0
- xdataapi/models/error.py +78 -0
- xdataapi/models/error_body.py +72 -0
- xdataapi/models/error_body_code.py +22 -0
- xdataapi/models/get_me_response_200.py +88 -0
- xdataapi/models/get_tweets_body.py +61 -0
- xdataapi/models/get_users_body.py +61 -0
- xdataapi/models/id_page.py +117 -0
- xdataapi/models/list_packs_response_200.py +105 -0
- xdataapi/models/list_packs_response_200_data_item.py +88 -0
- xdataapi/models/list_packs_response_200_rate_limits_item.py +70 -0
- xdataapi/models/media.py +96 -0
- xdataapi/models/media_type.py +10 -0
- xdataapi/models/meta.py +106 -0
- xdataapi/models/meta_cache.py +10 -0
- xdataapi/models/problem.py +131 -0
- xdataapi/models/search_tweets_product.py +12 -0
- xdataapi/models/tweet.py +310 -0
- xdataapi/models/tweet_batch.py +150 -0
- xdataapi/models/tweet_page.py +133 -0
- xdataapi/models/tweet_response.py +128 -0
- xdataapi/models/user.py +204 -0
- xdataapi/models/user_batch.py +150 -0
- xdataapi/models/user_page.py +133 -0
- xdataapi/models/user_response.py +128 -0
- xdataapi/py.typed +1 -0
- xdataapi/types.py +54 -0
- xdataapi-0.3.0.dist-info/METADATA +148 -0
- xdataapi-0.3.0.dist-info/RECORD +61 -0
- xdataapi-0.3.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.user_page import UserPage
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
user: str,
|
|
16
|
+
*,
|
|
17
|
+
count: int | Unset = 50,
|
|
18
|
+
cursor: str | Unset = UNSET,
|
|
19
|
+
fresh: bool | Unset = False,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
params: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
params["count"] = count
|
|
25
|
+
|
|
26
|
+
params["cursor"] = cursor
|
|
27
|
+
|
|
28
|
+
params["fresh"] = fresh
|
|
29
|
+
|
|
30
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
31
|
+
|
|
32
|
+
_kwargs: dict[str, Any] = {
|
|
33
|
+
"method": "get",
|
|
34
|
+
"url": "/v1/users/{user}/followers".format(
|
|
35
|
+
user=quote(str(user), safe=""),
|
|
36
|
+
),
|
|
37
|
+
"params": params,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | UserPage | None:
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
response_200 = UserPage.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_200
|
|
48
|
+
|
|
49
|
+
if response.status_code == 401:
|
|
50
|
+
response_401 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_401
|
|
53
|
+
|
|
54
|
+
if response.status_code == 402:
|
|
55
|
+
response_402 = Error.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_402
|
|
58
|
+
|
|
59
|
+
if response.status_code == 403:
|
|
60
|
+
response_403 = Error.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_403
|
|
63
|
+
|
|
64
|
+
if response.status_code == 404:
|
|
65
|
+
response_404 = Error.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_404
|
|
68
|
+
|
|
69
|
+
if response.status_code == 429:
|
|
70
|
+
response_429 = Error.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_429
|
|
73
|
+
|
|
74
|
+
if response.status_code == 500:
|
|
75
|
+
response_500 = Error.from_dict(response.json())
|
|
76
|
+
|
|
77
|
+
return response_500
|
|
78
|
+
|
|
79
|
+
if response.status_code == 503:
|
|
80
|
+
response_503 = Error.from_dict(response.json())
|
|
81
|
+
|
|
82
|
+
return response_503
|
|
83
|
+
|
|
84
|
+
if client.raise_on_unexpected_status:
|
|
85
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
86
|
+
else:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | UserPage]:
|
|
91
|
+
return Response(
|
|
92
|
+
status_code=HTTPStatus(response.status_code),
|
|
93
|
+
content=response.content,
|
|
94
|
+
headers=response.headers,
|
|
95
|
+
parsed=_parse_response(client=client, response=response),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def sync_detailed(
|
|
100
|
+
user: str,
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient | Client,
|
|
103
|
+
count: int | Unset = 50,
|
|
104
|
+
cursor: str | Unset = UNSET,
|
|
105
|
+
fresh: bool | Unset = False,
|
|
106
|
+
) -> Response[Error | UserPage]:
|
|
107
|
+
"""Followers of a user
|
|
108
|
+
|
|
109
|
+
0.1 credit per user returned. Up to 200 per page.
|
|
110
|
+
Availability depends on the reading session's trust level at X: some sessions get HTTP 403
|
|
111
|
+
`access_denied` (X error 37) for every follower list, including their own. Free when that happens.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
user (str):
|
|
115
|
+
count (int | Unset): Default: 50.
|
|
116
|
+
cursor (str | Unset):
|
|
117
|
+
fresh (bool | Unset): Default: False.
|
|
118
|
+
|
|
119
|
+
Raises:
|
|
120
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
121
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
Response[Error | UserPage]
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
kwargs = _get_kwargs(
|
|
128
|
+
user=user,
|
|
129
|
+
count=count,
|
|
130
|
+
cursor=cursor,
|
|
131
|
+
fresh=fresh,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
response = client.get_httpx_client().request(
|
|
135
|
+
**kwargs,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
return _build_response(client=client, response=response)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def sync(
|
|
142
|
+
user: str,
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient | Client,
|
|
145
|
+
count: int | Unset = 50,
|
|
146
|
+
cursor: str | Unset = UNSET,
|
|
147
|
+
fresh: bool | Unset = False,
|
|
148
|
+
) -> Error | UserPage | None:
|
|
149
|
+
"""Followers of a user
|
|
150
|
+
|
|
151
|
+
0.1 credit per user returned. Up to 200 per page.
|
|
152
|
+
Availability depends on the reading session's trust level at X: some sessions get HTTP 403
|
|
153
|
+
`access_denied` (X error 37) for every follower list, including their own. Free when that happens.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
user (str):
|
|
157
|
+
count (int | Unset): Default: 50.
|
|
158
|
+
cursor (str | Unset):
|
|
159
|
+
fresh (bool | Unset): Default: False.
|
|
160
|
+
|
|
161
|
+
Raises:
|
|
162
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
163
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
Error | UserPage
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
return sync_detailed(
|
|
170
|
+
user=user,
|
|
171
|
+
client=client,
|
|
172
|
+
count=count,
|
|
173
|
+
cursor=cursor,
|
|
174
|
+
fresh=fresh,
|
|
175
|
+
).parsed
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
async def asyncio_detailed(
|
|
179
|
+
user: str,
|
|
180
|
+
*,
|
|
181
|
+
client: AuthenticatedClient | Client,
|
|
182
|
+
count: int | Unset = 50,
|
|
183
|
+
cursor: str | Unset = UNSET,
|
|
184
|
+
fresh: bool | Unset = False,
|
|
185
|
+
) -> Response[Error | UserPage]:
|
|
186
|
+
"""Followers of a user
|
|
187
|
+
|
|
188
|
+
0.1 credit per user returned. Up to 200 per page.
|
|
189
|
+
Availability depends on the reading session's trust level at X: some sessions get HTTP 403
|
|
190
|
+
`access_denied` (X error 37) for every follower list, including their own. Free when that happens.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
user (str):
|
|
194
|
+
count (int | Unset): Default: 50.
|
|
195
|
+
cursor (str | Unset):
|
|
196
|
+
fresh (bool | Unset): Default: False.
|
|
197
|
+
|
|
198
|
+
Raises:
|
|
199
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
200
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
Response[Error | UserPage]
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
kwargs = _get_kwargs(
|
|
207
|
+
user=user,
|
|
208
|
+
count=count,
|
|
209
|
+
cursor=cursor,
|
|
210
|
+
fresh=fresh,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
214
|
+
|
|
215
|
+
return _build_response(client=client, response=response)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
async def asyncio(
|
|
219
|
+
user: str,
|
|
220
|
+
*,
|
|
221
|
+
client: AuthenticatedClient | Client,
|
|
222
|
+
count: int | Unset = 50,
|
|
223
|
+
cursor: str | Unset = UNSET,
|
|
224
|
+
fresh: bool | Unset = False,
|
|
225
|
+
) -> Error | UserPage | None:
|
|
226
|
+
"""Followers of a user
|
|
227
|
+
|
|
228
|
+
0.1 credit per user returned. Up to 200 per page.
|
|
229
|
+
Availability depends on the reading session's trust level at X: some sessions get HTTP 403
|
|
230
|
+
`access_denied` (X error 37) for every follower list, including their own. Free when that happens.
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
user (str):
|
|
234
|
+
count (int | Unset): Default: 50.
|
|
235
|
+
cursor (str | Unset):
|
|
236
|
+
fresh (bool | Unset): Default: False.
|
|
237
|
+
|
|
238
|
+
Raises:
|
|
239
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
240
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
241
|
+
|
|
242
|
+
Returns:
|
|
243
|
+
Error | UserPage
|
|
244
|
+
"""
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
await asyncio_detailed(
|
|
248
|
+
user=user,
|
|
249
|
+
client=client,
|
|
250
|
+
count=count,
|
|
251
|
+
cursor=cursor,
|
|
252
|
+
fresh=fresh,
|
|
253
|
+
)
|
|
254
|
+
).parsed
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.user_page import UserPage
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
user: str,
|
|
16
|
+
*,
|
|
17
|
+
count: int | Unset = 50,
|
|
18
|
+
cursor: str | Unset = UNSET,
|
|
19
|
+
fresh: bool | Unset = False,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
params: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
params["count"] = count
|
|
25
|
+
|
|
26
|
+
params["cursor"] = cursor
|
|
27
|
+
|
|
28
|
+
params["fresh"] = fresh
|
|
29
|
+
|
|
30
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
31
|
+
|
|
32
|
+
_kwargs: dict[str, Any] = {
|
|
33
|
+
"method": "get",
|
|
34
|
+
"url": "/v1/users/{user}/following".format(
|
|
35
|
+
user=quote(str(user), safe=""),
|
|
36
|
+
),
|
|
37
|
+
"params": params,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | UserPage | None:
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
response_200 = UserPage.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_200
|
|
48
|
+
|
|
49
|
+
if response.status_code == 401:
|
|
50
|
+
response_401 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_401
|
|
53
|
+
|
|
54
|
+
if response.status_code == 402:
|
|
55
|
+
response_402 = Error.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_402
|
|
58
|
+
|
|
59
|
+
if response.status_code == 403:
|
|
60
|
+
response_403 = Error.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_403
|
|
63
|
+
|
|
64
|
+
if response.status_code == 404:
|
|
65
|
+
response_404 = Error.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_404
|
|
68
|
+
|
|
69
|
+
if response.status_code == 429:
|
|
70
|
+
response_429 = Error.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_429
|
|
73
|
+
|
|
74
|
+
if response.status_code == 500:
|
|
75
|
+
response_500 = Error.from_dict(response.json())
|
|
76
|
+
|
|
77
|
+
return response_500
|
|
78
|
+
|
|
79
|
+
if response.status_code == 503:
|
|
80
|
+
response_503 = Error.from_dict(response.json())
|
|
81
|
+
|
|
82
|
+
return response_503
|
|
83
|
+
|
|
84
|
+
if client.raise_on_unexpected_status:
|
|
85
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
86
|
+
else:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | UserPage]:
|
|
91
|
+
return Response(
|
|
92
|
+
status_code=HTTPStatus(response.status_code),
|
|
93
|
+
content=response.content,
|
|
94
|
+
headers=response.headers,
|
|
95
|
+
parsed=_parse_response(client=client, response=response),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def sync_detailed(
|
|
100
|
+
user: str,
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient | Client,
|
|
103
|
+
count: int | Unset = 50,
|
|
104
|
+
cursor: str | Unset = UNSET,
|
|
105
|
+
fresh: bool | Unset = False,
|
|
106
|
+
) -> Response[Error | UserPage]:
|
|
107
|
+
"""Accounts a user follows
|
|
108
|
+
|
|
109
|
+
0.1 credit per user returned. Up to 200 per page. Same availability note as followers.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
user (str):
|
|
113
|
+
count (int | Unset): Default: 50.
|
|
114
|
+
cursor (str | Unset):
|
|
115
|
+
fresh (bool | Unset): Default: False.
|
|
116
|
+
|
|
117
|
+
Raises:
|
|
118
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
119
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
Response[Error | UserPage]
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
kwargs = _get_kwargs(
|
|
126
|
+
user=user,
|
|
127
|
+
count=count,
|
|
128
|
+
cursor=cursor,
|
|
129
|
+
fresh=fresh,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
response = client.get_httpx_client().request(
|
|
133
|
+
**kwargs,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
return _build_response(client=client, response=response)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def sync(
|
|
140
|
+
user: str,
|
|
141
|
+
*,
|
|
142
|
+
client: AuthenticatedClient | Client,
|
|
143
|
+
count: int | Unset = 50,
|
|
144
|
+
cursor: str | Unset = UNSET,
|
|
145
|
+
fresh: bool | Unset = False,
|
|
146
|
+
) -> Error | UserPage | None:
|
|
147
|
+
"""Accounts a user follows
|
|
148
|
+
|
|
149
|
+
0.1 credit per user returned. Up to 200 per page. Same availability note as followers.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
user (str):
|
|
153
|
+
count (int | Unset): Default: 50.
|
|
154
|
+
cursor (str | Unset):
|
|
155
|
+
fresh (bool | Unset): Default: False.
|
|
156
|
+
|
|
157
|
+
Raises:
|
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Error | UserPage
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
return sync_detailed(
|
|
166
|
+
user=user,
|
|
167
|
+
client=client,
|
|
168
|
+
count=count,
|
|
169
|
+
cursor=cursor,
|
|
170
|
+
fresh=fresh,
|
|
171
|
+
).parsed
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
async def asyncio_detailed(
|
|
175
|
+
user: str,
|
|
176
|
+
*,
|
|
177
|
+
client: AuthenticatedClient | Client,
|
|
178
|
+
count: int | Unset = 50,
|
|
179
|
+
cursor: str | Unset = UNSET,
|
|
180
|
+
fresh: bool | Unset = False,
|
|
181
|
+
) -> Response[Error | UserPage]:
|
|
182
|
+
"""Accounts a user follows
|
|
183
|
+
|
|
184
|
+
0.1 credit per user returned. Up to 200 per page. Same availability note as followers.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
user (str):
|
|
188
|
+
count (int | Unset): Default: 50.
|
|
189
|
+
cursor (str | Unset):
|
|
190
|
+
fresh (bool | Unset): Default: False.
|
|
191
|
+
|
|
192
|
+
Raises:
|
|
193
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
194
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
Response[Error | UserPage]
|
|
198
|
+
"""
|
|
199
|
+
|
|
200
|
+
kwargs = _get_kwargs(
|
|
201
|
+
user=user,
|
|
202
|
+
count=count,
|
|
203
|
+
cursor=cursor,
|
|
204
|
+
fresh=fresh,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
208
|
+
|
|
209
|
+
return _build_response(client=client, response=response)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
async def asyncio(
|
|
213
|
+
user: str,
|
|
214
|
+
*,
|
|
215
|
+
client: AuthenticatedClient | Client,
|
|
216
|
+
count: int | Unset = 50,
|
|
217
|
+
cursor: str | Unset = UNSET,
|
|
218
|
+
fresh: bool | Unset = False,
|
|
219
|
+
) -> Error | UserPage | None:
|
|
220
|
+
"""Accounts a user follows
|
|
221
|
+
|
|
222
|
+
0.1 credit per user returned. Up to 200 per page. Same availability note as followers.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
user (str):
|
|
226
|
+
count (int | Unset): Default: 50.
|
|
227
|
+
cursor (str | Unset):
|
|
228
|
+
fresh (bool | Unset): Default: False.
|
|
229
|
+
|
|
230
|
+
Raises:
|
|
231
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
232
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
Error | UserPage
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
await asyncio_detailed(
|
|
240
|
+
user=user,
|
|
241
|
+
client=client,
|
|
242
|
+
count=count,
|
|
243
|
+
cursor=cursor,
|
|
244
|
+
fresh=fresh,
|
|
245
|
+
)
|
|
246
|
+
).parsed
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.user_response import UserResponse
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
handle: str,
|
|
16
|
+
*,
|
|
17
|
+
fresh: bool | Unset = False,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
|
|
20
|
+
params: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
params["fresh"] = fresh
|
|
23
|
+
|
|
24
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
25
|
+
|
|
26
|
+
_kwargs: dict[str, Any] = {
|
|
27
|
+
"method": "get",
|
|
28
|
+
"url": "/v1/users/{handle}".format(
|
|
29
|
+
handle=quote(str(handle), safe=""),
|
|
30
|
+
),
|
|
31
|
+
"params": params,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | UserResponse | None:
|
|
38
|
+
if response.status_code == 200:
|
|
39
|
+
response_200 = UserResponse.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_200
|
|
42
|
+
|
|
43
|
+
if response.status_code == 401:
|
|
44
|
+
response_401 = Error.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_401
|
|
47
|
+
|
|
48
|
+
if response.status_code == 402:
|
|
49
|
+
response_402 = Error.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_402
|
|
52
|
+
|
|
53
|
+
if response.status_code == 404:
|
|
54
|
+
response_404 = Error.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_404
|
|
57
|
+
|
|
58
|
+
if response.status_code == 429:
|
|
59
|
+
response_429 = Error.from_dict(response.json())
|
|
60
|
+
|
|
61
|
+
return response_429
|
|
62
|
+
|
|
63
|
+
if response.status_code == 500:
|
|
64
|
+
response_500 = Error.from_dict(response.json())
|
|
65
|
+
|
|
66
|
+
return response_500
|
|
67
|
+
|
|
68
|
+
if response.status_code == 503:
|
|
69
|
+
response_503 = Error.from_dict(response.json())
|
|
70
|
+
|
|
71
|
+
return response_503
|
|
72
|
+
|
|
73
|
+
if client.raise_on_unexpected_status:
|
|
74
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
75
|
+
else:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _build_response(
|
|
80
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
81
|
+
) -> Response[Error | UserResponse]:
|
|
82
|
+
return Response(
|
|
83
|
+
status_code=HTTPStatus(response.status_code),
|
|
84
|
+
content=response.content,
|
|
85
|
+
headers=response.headers,
|
|
86
|
+
parsed=_parse_response(client=client, response=response),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def sync_detailed(
|
|
91
|
+
handle: str,
|
|
92
|
+
*,
|
|
93
|
+
client: AuthenticatedClient | Client,
|
|
94
|
+
fresh: bool | Unset = False,
|
|
95
|
+
) -> Response[Error | UserResponse]:
|
|
96
|
+
"""Profile by handle
|
|
97
|
+
|
|
98
|
+
1 credit per profile.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
handle (str):
|
|
102
|
+
fresh (bool | Unset): Default: False.
|
|
103
|
+
|
|
104
|
+
Raises:
|
|
105
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
106
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
Response[Error | UserResponse]
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
kwargs = _get_kwargs(
|
|
113
|
+
handle=handle,
|
|
114
|
+
fresh=fresh,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
response = client.get_httpx_client().request(
|
|
118
|
+
**kwargs,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return _build_response(client=client, response=response)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def sync(
|
|
125
|
+
handle: str,
|
|
126
|
+
*,
|
|
127
|
+
client: AuthenticatedClient | Client,
|
|
128
|
+
fresh: bool | Unset = False,
|
|
129
|
+
) -> Error | UserResponse | None:
|
|
130
|
+
"""Profile by handle
|
|
131
|
+
|
|
132
|
+
1 credit per profile.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
handle (str):
|
|
136
|
+
fresh (bool | Unset): Default: False.
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
140
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
Error | UserResponse
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
return sync_detailed(
|
|
147
|
+
handle=handle,
|
|
148
|
+
client=client,
|
|
149
|
+
fresh=fresh,
|
|
150
|
+
).parsed
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async def asyncio_detailed(
|
|
154
|
+
handle: str,
|
|
155
|
+
*,
|
|
156
|
+
client: AuthenticatedClient | Client,
|
|
157
|
+
fresh: bool | Unset = False,
|
|
158
|
+
) -> Response[Error | UserResponse]:
|
|
159
|
+
"""Profile by handle
|
|
160
|
+
|
|
161
|
+
1 credit per profile.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
handle (str):
|
|
165
|
+
fresh (bool | Unset): Default: False.
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
169
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
Response[Error | UserResponse]
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
kwargs = _get_kwargs(
|
|
176
|
+
handle=handle,
|
|
177
|
+
fresh=fresh,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
181
|
+
|
|
182
|
+
return _build_response(client=client, response=response)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
async def asyncio(
|
|
186
|
+
handle: str,
|
|
187
|
+
*,
|
|
188
|
+
client: AuthenticatedClient | Client,
|
|
189
|
+
fresh: bool | Unset = False,
|
|
190
|
+
) -> Error | UserResponse | None:
|
|
191
|
+
"""Profile by handle
|
|
192
|
+
|
|
193
|
+
1 credit per profile.
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
handle (str):
|
|
197
|
+
fresh (bool | Unset): Default: False.
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
201
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
202
|
+
|
|
203
|
+
Returns:
|
|
204
|
+
Error | UserResponse
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
await asyncio_detailed(
|
|
209
|
+
handle=handle,
|
|
210
|
+
client=client,
|
|
211
|
+
fresh=fresh,
|
|
212
|
+
)
|
|
213
|
+
).parsed
|