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,241 @@
|
|
|
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.tweet_page import TweetPage
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
id: str,
|
|
16
|
+
*,
|
|
17
|
+
count: int | Unset = 20,
|
|
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/tweets/{id}/quotes".format(
|
|
35
|
+
id=quote(str(id), safe=""),
|
|
36
|
+
),
|
|
37
|
+
"params": params,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | TweetPage | None:
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
response_200 = TweetPage.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 == 429:
|
|
65
|
+
response_429 = Error.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_429
|
|
68
|
+
|
|
69
|
+
if response.status_code == 500:
|
|
70
|
+
response_500 = Error.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_500
|
|
73
|
+
|
|
74
|
+
if response.status_code == 503:
|
|
75
|
+
response_503 = Error.from_dict(response.json())
|
|
76
|
+
|
|
77
|
+
return response_503
|
|
78
|
+
|
|
79
|
+
if client.raise_on_unexpected_status:
|
|
80
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
81
|
+
else:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | TweetPage]:
|
|
86
|
+
return Response(
|
|
87
|
+
status_code=HTTPStatus(response.status_code),
|
|
88
|
+
content=response.content,
|
|
89
|
+
headers=response.headers,
|
|
90
|
+
parsed=_parse_response(client=client, response=response),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def sync_detailed(
|
|
95
|
+
id: str,
|
|
96
|
+
*,
|
|
97
|
+
client: AuthenticatedClient | Client,
|
|
98
|
+
count: int | Unset = 20,
|
|
99
|
+
cursor: str | Unset = UNSET,
|
|
100
|
+
fresh: bool | Unset = False,
|
|
101
|
+
) -> Response[Error | TweetPage]:
|
|
102
|
+
"""Tweets that quote a tweet
|
|
103
|
+
|
|
104
|
+
1 credit per tweet, newest first. Up to 50 per page.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
id (str):
|
|
108
|
+
count (int | Unset): Default: 20.
|
|
109
|
+
cursor (str | Unset):
|
|
110
|
+
fresh (bool | Unset): Default: False.
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Response[Error | TweetPage]
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
kwargs = _get_kwargs(
|
|
121
|
+
id=id,
|
|
122
|
+
count=count,
|
|
123
|
+
cursor=cursor,
|
|
124
|
+
fresh=fresh,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = client.get_httpx_client().request(
|
|
128
|
+
**kwargs,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return _build_response(client=client, response=response)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def sync(
|
|
135
|
+
id: str,
|
|
136
|
+
*,
|
|
137
|
+
client: AuthenticatedClient | Client,
|
|
138
|
+
count: int | Unset = 20,
|
|
139
|
+
cursor: str | Unset = UNSET,
|
|
140
|
+
fresh: bool | Unset = False,
|
|
141
|
+
) -> Error | TweetPage | None:
|
|
142
|
+
"""Tweets that quote a tweet
|
|
143
|
+
|
|
144
|
+
1 credit per tweet, newest first. Up to 50 per page.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
id (str):
|
|
148
|
+
count (int | Unset): Default: 20.
|
|
149
|
+
cursor (str | Unset):
|
|
150
|
+
fresh (bool | Unset): Default: False.
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
154
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Error | TweetPage
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
return sync_detailed(
|
|
161
|
+
id=id,
|
|
162
|
+
client=client,
|
|
163
|
+
count=count,
|
|
164
|
+
cursor=cursor,
|
|
165
|
+
fresh=fresh,
|
|
166
|
+
).parsed
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
async def asyncio_detailed(
|
|
170
|
+
id: str,
|
|
171
|
+
*,
|
|
172
|
+
client: AuthenticatedClient | Client,
|
|
173
|
+
count: int | Unset = 20,
|
|
174
|
+
cursor: str | Unset = UNSET,
|
|
175
|
+
fresh: bool | Unset = False,
|
|
176
|
+
) -> Response[Error | TweetPage]:
|
|
177
|
+
"""Tweets that quote a tweet
|
|
178
|
+
|
|
179
|
+
1 credit per tweet, newest first. Up to 50 per page.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
id (str):
|
|
183
|
+
count (int | Unset): Default: 20.
|
|
184
|
+
cursor (str | Unset):
|
|
185
|
+
fresh (bool | Unset): Default: False.
|
|
186
|
+
|
|
187
|
+
Raises:
|
|
188
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
189
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
Response[Error | TweetPage]
|
|
193
|
+
"""
|
|
194
|
+
|
|
195
|
+
kwargs = _get_kwargs(
|
|
196
|
+
id=id,
|
|
197
|
+
count=count,
|
|
198
|
+
cursor=cursor,
|
|
199
|
+
fresh=fresh,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
203
|
+
|
|
204
|
+
return _build_response(client=client, response=response)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
async def asyncio(
|
|
208
|
+
id: str,
|
|
209
|
+
*,
|
|
210
|
+
client: AuthenticatedClient | Client,
|
|
211
|
+
count: int | Unset = 20,
|
|
212
|
+
cursor: str | Unset = UNSET,
|
|
213
|
+
fresh: bool | Unset = False,
|
|
214
|
+
) -> Error | TweetPage | None:
|
|
215
|
+
"""Tweets that quote a tweet
|
|
216
|
+
|
|
217
|
+
1 credit per tweet, newest first. Up to 50 per page.
|
|
218
|
+
|
|
219
|
+
Args:
|
|
220
|
+
id (str):
|
|
221
|
+
count (int | Unset): Default: 20.
|
|
222
|
+
cursor (str | Unset):
|
|
223
|
+
fresh (bool | Unset): Default: False.
|
|
224
|
+
|
|
225
|
+
Raises:
|
|
226
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
227
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
Error | TweetPage
|
|
231
|
+
"""
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
await asyncio_detailed(
|
|
235
|
+
id=id,
|
|
236
|
+
client=client,
|
|
237
|
+
count=count,
|
|
238
|
+
cursor=cursor,
|
|
239
|
+
fresh=fresh,
|
|
240
|
+
)
|
|
241
|
+
).parsed
|
|
@@ -0,0 +1,230 @@
|
|
|
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.tweet_page import TweetPage
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
id: str,
|
|
16
|
+
*,
|
|
17
|
+
cursor: str | Unset = UNSET,
|
|
18
|
+
fresh: bool | Unset = False,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
|
|
21
|
+
params: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
params["cursor"] = cursor
|
|
24
|
+
|
|
25
|
+
params["fresh"] = fresh
|
|
26
|
+
|
|
27
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
28
|
+
|
|
29
|
+
_kwargs: dict[str, Any] = {
|
|
30
|
+
"method": "get",
|
|
31
|
+
"url": "/v1/tweets/{id}/replies".format(
|
|
32
|
+
id=quote(str(id), safe=""),
|
|
33
|
+
),
|
|
34
|
+
"params": params,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return _kwargs
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | TweetPage | None:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = TweetPage.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_200
|
|
45
|
+
|
|
46
|
+
if response.status_code == 401:
|
|
47
|
+
response_401 = Error.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_401
|
|
50
|
+
|
|
51
|
+
if response.status_code == 402:
|
|
52
|
+
response_402 = Error.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_402
|
|
55
|
+
|
|
56
|
+
if response.status_code == 404:
|
|
57
|
+
response_404 = Error.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_404
|
|
60
|
+
|
|
61
|
+
if response.status_code == 429:
|
|
62
|
+
response_429 = Error.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_429
|
|
65
|
+
|
|
66
|
+
if response.status_code == 500:
|
|
67
|
+
response_500 = Error.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_500
|
|
70
|
+
|
|
71
|
+
if response.status_code == 503:
|
|
72
|
+
response_503 = Error.from_dict(response.json())
|
|
73
|
+
|
|
74
|
+
return response_503
|
|
75
|
+
|
|
76
|
+
if client.raise_on_unexpected_status:
|
|
77
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
78
|
+
else:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | TweetPage]:
|
|
83
|
+
return Response(
|
|
84
|
+
status_code=HTTPStatus(response.status_code),
|
|
85
|
+
content=response.content,
|
|
86
|
+
headers=response.headers,
|
|
87
|
+
parsed=_parse_response(client=client, response=response),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def sync_detailed(
|
|
92
|
+
id: str,
|
|
93
|
+
*,
|
|
94
|
+
client: AuthenticatedClient | Client,
|
|
95
|
+
cursor: str | Unset = UNSET,
|
|
96
|
+
fresh: bool | Unset = False,
|
|
97
|
+
) -> Response[Error | TweetPage]:
|
|
98
|
+
"""Direct replies to a tweet
|
|
99
|
+
|
|
100
|
+
1 credit per reply. Only replies to this tweet, not the thread above it or nested replies. Use
|
|
101
|
+
`cursor` for more.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
id (str):
|
|
105
|
+
cursor (str | Unset):
|
|
106
|
+
fresh (bool | Unset): Default: False.
|
|
107
|
+
|
|
108
|
+
Raises:
|
|
109
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
110
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
Response[Error | TweetPage]
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
kwargs = _get_kwargs(
|
|
117
|
+
id=id,
|
|
118
|
+
cursor=cursor,
|
|
119
|
+
fresh=fresh,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
response = client.get_httpx_client().request(
|
|
123
|
+
**kwargs,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
return _build_response(client=client, response=response)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def sync(
|
|
130
|
+
id: str,
|
|
131
|
+
*,
|
|
132
|
+
client: AuthenticatedClient | Client,
|
|
133
|
+
cursor: str | Unset = UNSET,
|
|
134
|
+
fresh: bool | Unset = False,
|
|
135
|
+
) -> Error | TweetPage | None:
|
|
136
|
+
"""Direct replies to a tweet
|
|
137
|
+
|
|
138
|
+
1 credit per reply. Only replies to this tweet, not the thread above it or nested replies. Use
|
|
139
|
+
`cursor` for more.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
id (str):
|
|
143
|
+
cursor (str | Unset):
|
|
144
|
+
fresh (bool | Unset): Default: False.
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Error | TweetPage
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
return sync_detailed(
|
|
155
|
+
id=id,
|
|
156
|
+
client=client,
|
|
157
|
+
cursor=cursor,
|
|
158
|
+
fresh=fresh,
|
|
159
|
+
).parsed
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
async def asyncio_detailed(
|
|
163
|
+
id: str,
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient | Client,
|
|
166
|
+
cursor: str | Unset = UNSET,
|
|
167
|
+
fresh: bool | Unset = False,
|
|
168
|
+
) -> Response[Error | TweetPage]:
|
|
169
|
+
"""Direct replies to a tweet
|
|
170
|
+
|
|
171
|
+
1 credit per reply. Only replies to this tweet, not the thread above it or nested replies. Use
|
|
172
|
+
`cursor` for more.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
id (str):
|
|
176
|
+
cursor (str | Unset):
|
|
177
|
+
fresh (bool | Unset): Default: False.
|
|
178
|
+
|
|
179
|
+
Raises:
|
|
180
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
181
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
Response[Error | TweetPage]
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
kwargs = _get_kwargs(
|
|
188
|
+
id=id,
|
|
189
|
+
cursor=cursor,
|
|
190
|
+
fresh=fresh,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
194
|
+
|
|
195
|
+
return _build_response(client=client, response=response)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
async def asyncio(
|
|
199
|
+
id: str,
|
|
200
|
+
*,
|
|
201
|
+
client: AuthenticatedClient | Client,
|
|
202
|
+
cursor: str | Unset = UNSET,
|
|
203
|
+
fresh: bool | Unset = False,
|
|
204
|
+
) -> Error | TweetPage | None:
|
|
205
|
+
"""Direct replies to a tweet
|
|
206
|
+
|
|
207
|
+
1 credit per reply. Only replies to this tweet, not the thread above it or nested replies. Use
|
|
208
|
+
`cursor` for more.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
id (str):
|
|
212
|
+
cursor (str | Unset):
|
|
213
|
+
fresh (bool | Unset): Default: False.
|
|
214
|
+
|
|
215
|
+
Raises:
|
|
216
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
217
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
Error | TweetPage
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
await asyncio_detailed(
|
|
225
|
+
id=id,
|
|
226
|
+
client=client,
|
|
227
|
+
cursor=cursor,
|
|
228
|
+
fresh=fresh,
|
|
229
|
+
)
|
|
230
|
+
).parsed
|
|
@@ -0,0 +1,245 @@
|
|
|
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
|
+
id: 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/tweets/{id}/retweeters".format(
|
|
35
|
+
id=quote(str(id), 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 == 429:
|
|
65
|
+
response_429 = Error.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_429
|
|
68
|
+
|
|
69
|
+
if response.status_code == 500:
|
|
70
|
+
response_500 = Error.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_500
|
|
73
|
+
|
|
74
|
+
if response.status_code == 503:
|
|
75
|
+
response_503 = Error.from_dict(response.json())
|
|
76
|
+
|
|
77
|
+
return response_503
|
|
78
|
+
|
|
79
|
+
if client.raise_on_unexpected_status:
|
|
80
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
81
|
+
else:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | UserPage]:
|
|
86
|
+
return Response(
|
|
87
|
+
status_code=HTTPStatus(response.status_code),
|
|
88
|
+
content=response.content,
|
|
89
|
+
headers=response.headers,
|
|
90
|
+
parsed=_parse_response(client=client, response=response),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def sync_detailed(
|
|
95
|
+
id: str,
|
|
96
|
+
*,
|
|
97
|
+
client: AuthenticatedClient | Client,
|
|
98
|
+
count: int | Unset = 50,
|
|
99
|
+
cursor: str | Unset = UNSET,
|
|
100
|
+
fresh: bool | Unset = False,
|
|
101
|
+
) -> Response[Error | UserPage]:
|
|
102
|
+
"""Accounts that retweeted a tweet
|
|
103
|
+
|
|
104
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
105
|
+
answer is 403 and free.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
id (str):
|
|
109
|
+
count (int | Unset): Default: 50.
|
|
110
|
+
cursor (str | Unset):
|
|
111
|
+
fresh (bool | Unset): Default: False.
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
115
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Response[Error | UserPage]
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
kwargs = _get_kwargs(
|
|
122
|
+
id=id,
|
|
123
|
+
count=count,
|
|
124
|
+
cursor=cursor,
|
|
125
|
+
fresh=fresh,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
response = client.get_httpx_client().request(
|
|
129
|
+
**kwargs,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
return _build_response(client=client, response=response)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def sync(
|
|
136
|
+
id: str,
|
|
137
|
+
*,
|
|
138
|
+
client: AuthenticatedClient | Client,
|
|
139
|
+
count: int | Unset = 50,
|
|
140
|
+
cursor: str | Unset = UNSET,
|
|
141
|
+
fresh: bool | Unset = False,
|
|
142
|
+
) -> Error | UserPage | None:
|
|
143
|
+
"""Accounts that retweeted a tweet
|
|
144
|
+
|
|
145
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
146
|
+
answer is 403 and free.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
id (str):
|
|
150
|
+
count (int | Unset): Default: 50.
|
|
151
|
+
cursor (str | Unset):
|
|
152
|
+
fresh (bool | Unset): Default: False.
|
|
153
|
+
|
|
154
|
+
Raises:
|
|
155
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
156
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
Error | UserPage
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
return sync_detailed(
|
|
163
|
+
id=id,
|
|
164
|
+
client=client,
|
|
165
|
+
count=count,
|
|
166
|
+
cursor=cursor,
|
|
167
|
+
fresh=fresh,
|
|
168
|
+
).parsed
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
async def asyncio_detailed(
|
|
172
|
+
id: str,
|
|
173
|
+
*,
|
|
174
|
+
client: AuthenticatedClient | Client,
|
|
175
|
+
count: int | Unset = 50,
|
|
176
|
+
cursor: str | Unset = UNSET,
|
|
177
|
+
fresh: bool | Unset = False,
|
|
178
|
+
) -> Response[Error | UserPage]:
|
|
179
|
+
"""Accounts that retweeted a tweet
|
|
180
|
+
|
|
181
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
182
|
+
answer is 403 and free.
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
id (str):
|
|
186
|
+
count (int | Unset): Default: 50.
|
|
187
|
+
cursor (str | Unset):
|
|
188
|
+
fresh (bool | Unset): Default: False.
|
|
189
|
+
|
|
190
|
+
Raises:
|
|
191
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
192
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
Response[Error | UserPage]
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
kwargs = _get_kwargs(
|
|
199
|
+
id=id,
|
|
200
|
+
count=count,
|
|
201
|
+
cursor=cursor,
|
|
202
|
+
fresh=fresh,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
206
|
+
|
|
207
|
+
return _build_response(client=client, response=response)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
async def asyncio(
|
|
211
|
+
id: str,
|
|
212
|
+
*,
|
|
213
|
+
client: AuthenticatedClient | Client,
|
|
214
|
+
count: int | Unset = 50,
|
|
215
|
+
cursor: str | Unset = UNSET,
|
|
216
|
+
fresh: bool | Unset = False,
|
|
217
|
+
) -> Error | UserPage | None:
|
|
218
|
+
"""Accounts that retweeted a tweet
|
|
219
|
+
|
|
220
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
221
|
+
answer is 403 and free.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
id (str):
|
|
225
|
+
count (int | Unset): Default: 50.
|
|
226
|
+
cursor (str | Unset):
|
|
227
|
+
fresh (bool | Unset): Default: False.
|
|
228
|
+
|
|
229
|
+
Raises:
|
|
230
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
231
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
Error | UserPage
|
|
235
|
+
"""
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
await asyncio_detailed(
|
|
239
|
+
id=id,
|
|
240
|
+
client=client,
|
|
241
|
+
count=count,
|
|
242
|
+
cursor=cursor,
|
|
243
|
+
fresh=fresh,
|
|
244
|
+
)
|
|
245
|
+
).parsed
|