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,226 @@
|
|
|
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}/thread".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
|
+
"""Tweet with its thread and replies
|
|
99
|
+
|
|
100
|
+
1 credit per tweet returned. The focal tweet comes first.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
id (str):
|
|
104
|
+
cursor (str | Unset):
|
|
105
|
+
fresh (bool | Unset): Default: False.
|
|
106
|
+
|
|
107
|
+
Raises:
|
|
108
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
109
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Response[Error | TweetPage]
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
kwargs = _get_kwargs(
|
|
116
|
+
id=id,
|
|
117
|
+
cursor=cursor,
|
|
118
|
+
fresh=fresh,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
response = client.get_httpx_client().request(
|
|
122
|
+
**kwargs,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
return _build_response(client=client, response=response)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def sync(
|
|
129
|
+
id: str,
|
|
130
|
+
*,
|
|
131
|
+
client: AuthenticatedClient | Client,
|
|
132
|
+
cursor: str | Unset = UNSET,
|
|
133
|
+
fresh: bool | Unset = False,
|
|
134
|
+
) -> Error | TweetPage | None:
|
|
135
|
+
"""Tweet with its thread and replies
|
|
136
|
+
|
|
137
|
+
1 credit per tweet returned. The focal tweet comes first.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
id (str):
|
|
141
|
+
cursor (str | Unset):
|
|
142
|
+
fresh (bool | Unset): Default: False.
|
|
143
|
+
|
|
144
|
+
Raises:
|
|
145
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
146
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Error | TweetPage
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
return sync_detailed(
|
|
153
|
+
id=id,
|
|
154
|
+
client=client,
|
|
155
|
+
cursor=cursor,
|
|
156
|
+
fresh=fresh,
|
|
157
|
+
).parsed
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
async def asyncio_detailed(
|
|
161
|
+
id: str,
|
|
162
|
+
*,
|
|
163
|
+
client: AuthenticatedClient | Client,
|
|
164
|
+
cursor: str | Unset = UNSET,
|
|
165
|
+
fresh: bool | Unset = False,
|
|
166
|
+
) -> Response[Error | TweetPage]:
|
|
167
|
+
"""Tweet with its thread and replies
|
|
168
|
+
|
|
169
|
+
1 credit per tweet returned. The focal tweet comes first.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
id (str):
|
|
173
|
+
cursor (str | Unset):
|
|
174
|
+
fresh (bool | Unset): Default: False.
|
|
175
|
+
|
|
176
|
+
Raises:
|
|
177
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
178
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
Response[Error | TweetPage]
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
kwargs = _get_kwargs(
|
|
185
|
+
id=id,
|
|
186
|
+
cursor=cursor,
|
|
187
|
+
fresh=fresh,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
191
|
+
|
|
192
|
+
return _build_response(client=client, response=response)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
async def asyncio(
|
|
196
|
+
id: str,
|
|
197
|
+
*,
|
|
198
|
+
client: AuthenticatedClient | Client,
|
|
199
|
+
cursor: str | Unset = UNSET,
|
|
200
|
+
fresh: bool | Unset = False,
|
|
201
|
+
) -> Error | TweetPage | None:
|
|
202
|
+
"""Tweet with its thread and replies
|
|
203
|
+
|
|
204
|
+
1 credit per tweet returned. The focal tweet comes first.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
id (str):
|
|
208
|
+
cursor (str | Unset):
|
|
209
|
+
fresh (bool | Unset): Default: False.
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
213
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
Error | TweetPage
|
|
217
|
+
"""
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
await asyncio_detailed(
|
|
221
|
+
id=id,
|
|
222
|
+
client=client,
|
|
223
|
+
cursor=cursor,
|
|
224
|
+
fresh=fresh,
|
|
225
|
+
)
|
|
226
|
+
).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.tweet_response import TweetResponse
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
id: 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/tweets/{id}".format(
|
|
29
|
+
id=quote(str(id), safe=""),
|
|
30
|
+
),
|
|
31
|
+
"params": params,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | TweetResponse | None:
|
|
38
|
+
if response.status_code == 200:
|
|
39
|
+
response_200 = TweetResponse.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 | TweetResponse]:
|
|
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
|
+
id: str,
|
|
92
|
+
*,
|
|
93
|
+
client: AuthenticatedClient | Client,
|
|
94
|
+
fresh: bool | Unset = False,
|
|
95
|
+
) -> Response[Error | TweetResponse]:
|
|
96
|
+
"""Tweet by id
|
|
97
|
+
|
|
98
|
+
1 credit.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
id (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 | TweetResponse]
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
kwargs = _get_kwargs(
|
|
113
|
+
id=id,
|
|
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
|
+
id: str,
|
|
126
|
+
*,
|
|
127
|
+
client: AuthenticatedClient | Client,
|
|
128
|
+
fresh: bool | Unset = False,
|
|
129
|
+
) -> Error | TweetResponse | None:
|
|
130
|
+
"""Tweet by id
|
|
131
|
+
|
|
132
|
+
1 credit.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
id (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 | TweetResponse
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
return sync_detailed(
|
|
147
|
+
id=id,
|
|
148
|
+
client=client,
|
|
149
|
+
fresh=fresh,
|
|
150
|
+
).parsed
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async def asyncio_detailed(
|
|
154
|
+
id: str,
|
|
155
|
+
*,
|
|
156
|
+
client: AuthenticatedClient | Client,
|
|
157
|
+
fresh: bool | Unset = False,
|
|
158
|
+
) -> Response[Error | TweetResponse]:
|
|
159
|
+
"""Tweet by id
|
|
160
|
+
|
|
161
|
+
1 credit.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
id (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 | TweetResponse]
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
kwargs = _get_kwargs(
|
|
176
|
+
id=id,
|
|
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
|
+
id: str,
|
|
187
|
+
*,
|
|
188
|
+
client: AuthenticatedClient | Client,
|
|
189
|
+
fresh: bool | Unset = False,
|
|
190
|
+
) -> Error | TweetResponse | None:
|
|
191
|
+
"""Tweet by id
|
|
192
|
+
|
|
193
|
+
1 credit.
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
id (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 | TweetResponse
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
await asyncio_detailed(
|
|
209
|
+
id=id,
|
|
210
|
+
client=client,
|
|
211
|
+
fresh=fresh,
|
|
212
|
+
)
|
|
213
|
+
).parsed
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error import Error
|
|
9
|
+
from ...models.get_tweets_body import GetTweetsBody
|
|
10
|
+
from ...models.tweet_batch import TweetBatch
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: GetTweetsBody,
|
|
17
|
+
fresh: bool | Unset = False,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
params: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
params["fresh"] = fresh
|
|
24
|
+
|
|
25
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
26
|
+
|
|
27
|
+
_kwargs: dict[str, Any] = {
|
|
28
|
+
"method": "post",
|
|
29
|
+
"url": "/v1/tweets/batch",
|
|
30
|
+
"params": params,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_kwargs["json"] = body.to_dict()
|
|
34
|
+
|
|
35
|
+
headers["Content-Type"] = "application/json"
|
|
36
|
+
|
|
37
|
+
_kwargs["headers"] = headers
|
|
38
|
+
return _kwargs
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | TweetBatch | None:
|
|
42
|
+
if response.status_code == 200:
|
|
43
|
+
response_200 = TweetBatch.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_200
|
|
46
|
+
|
|
47
|
+
if response.status_code == 400:
|
|
48
|
+
response_400 = Error.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_400
|
|
51
|
+
|
|
52
|
+
if response.status_code == 401:
|
|
53
|
+
response_401 = Error.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_401
|
|
56
|
+
|
|
57
|
+
if response.status_code == 402:
|
|
58
|
+
response_402 = Error.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
return response_402
|
|
61
|
+
|
|
62
|
+
if response.status_code == 429:
|
|
63
|
+
response_429 = Error.from_dict(response.json())
|
|
64
|
+
|
|
65
|
+
return response_429
|
|
66
|
+
|
|
67
|
+
if response.status_code == 500:
|
|
68
|
+
response_500 = Error.from_dict(response.json())
|
|
69
|
+
|
|
70
|
+
return response_500
|
|
71
|
+
|
|
72
|
+
if response.status_code == 503:
|
|
73
|
+
response_503 = Error.from_dict(response.json())
|
|
74
|
+
|
|
75
|
+
return response_503
|
|
76
|
+
|
|
77
|
+
if client.raise_on_unexpected_status:
|
|
78
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
79
|
+
else:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | TweetBatch]:
|
|
84
|
+
return Response(
|
|
85
|
+
status_code=HTTPStatus(response.status_code),
|
|
86
|
+
content=response.content,
|
|
87
|
+
headers=response.headers,
|
|
88
|
+
parsed=_parse_response(client=client, response=response),
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def sync_detailed(
|
|
93
|
+
*,
|
|
94
|
+
client: AuthenticatedClient | Client,
|
|
95
|
+
body: GetTweetsBody,
|
|
96
|
+
fresh: bool | Unset = False,
|
|
97
|
+
) -> Response[Error | TweetBatch]:
|
|
98
|
+
"""Tweets by id, batch
|
|
99
|
+
|
|
100
|
+
Up to 100 tweets in one call. 1 credit per tweet found; deleted or private tweets are listed in
|
|
101
|
+
`errors`
|
|
102
|
+
and cost nothing. Results in input order. Also `GET /v1/tweets/batch?ids=20,21`.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
fresh (bool | Unset): Default: False.
|
|
106
|
+
body (GetTweetsBody):
|
|
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 | TweetBatch]
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
kwargs = _get_kwargs(
|
|
117
|
+
body=body,
|
|
118
|
+
fresh=fresh,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
response = client.get_httpx_client().request(
|
|
122
|
+
**kwargs,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
return _build_response(client=client, response=response)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def sync(
|
|
129
|
+
*,
|
|
130
|
+
client: AuthenticatedClient | Client,
|
|
131
|
+
body: GetTweetsBody,
|
|
132
|
+
fresh: bool | Unset = False,
|
|
133
|
+
) -> Error | TweetBatch | None:
|
|
134
|
+
"""Tweets by id, batch
|
|
135
|
+
|
|
136
|
+
Up to 100 tweets in one call. 1 credit per tweet found; deleted or private tweets are listed in
|
|
137
|
+
`errors`
|
|
138
|
+
and cost nothing. Results in input order. Also `GET /v1/tweets/batch?ids=20,21`.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
fresh (bool | Unset): Default: False.
|
|
142
|
+
body (GetTweetsBody):
|
|
143
|
+
|
|
144
|
+
Raises:
|
|
145
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
146
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Error | TweetBatch
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
return sync_detailed(
|
|
153
|
+
client=client,
|
|
154
|
+
body=body,
|
|
155
|
+
fresh=fresh,
|
|
156
|
+
).parsed
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
async def asyncio_detailed(
|
|
160
|
+
*,
|
|
161
|
+
client: AuthenticatedClient | Client,
|
|
162
|
+
body: GetTweetsBody,
|
|
163
|
+
fresh: bool | Unset = False,
|
|
164
|
+
) -> Response[Error | TweetBatch]:
|
|
165
|
+
"""Tweets by id, batch
|
|
166
|
+
|
|
167
|
+
Up to 100 tweets in one call. 1 credit per tweet found; deleted or private tweets are listed in
|
|
168
|
+
`errors`
|
|
169
|
+
and cost nothing. Results in input order. Also `GET /v1/tweets/batch?ids=20,21`.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
fresh (bool | Unset): Default: False.
|
|
173
|
+
body (GetTweetsBody):
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
177
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
Response[Error | TweetBatch]
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
kwargs = _get_kwargs(
|
|
184
|
+
body=body,
|
|
185
|
+
fresh=fresh,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
189
|
+
|
|
190
|
+
return _build_response(client=client, response=response)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
async def asyncio(
|
|
194
|
+
*,
|
|
195
|
+
client: AuthenticatedClient | Client,
|
|
196
|
+
body: GetTweetsBody,
|
|
197
|
+
fresh: bool | Unset = False,
|
|
198
|
+
) -> Error | TweetBatch | None:
|
|
199
|
+
"""Tweets by id, batch
|
|
200
|
+
|
|
201
|
+
Up to 100 tweets in one call. 1 credit per tweet found; deleted or private tweets are listed in
|
|
202
|
+
`errors`
|
|
203
|
+
and cost nothing. Results in input order. Also `GET /v1/tweets/batch?ids=20,21`.
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
fresh (bool | Unset): Default: False.
|
|
207
|
+
body (GetTweetsBody):
|
|
208
|
+
|
|
209
|
+
Raises:
|
|
210
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
211
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
Error | TweetBatch
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
await asyncio_detailed(
|
|
219
|
+
client=client,
|
|
220
|
+
body=body,
|
|
221
|
+
fresh=fresh,
|
|
222
|
+
)
|
|
223
|
+
).parsed
|