twitter-openapi-python 0.1.3__tar.gz → 0.1.4__tar.gz
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.
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/PKG-INFO +15 -2
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/README.md +13 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/pyproject.toml +2 -2
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/pyproject.toml.orig +2 -2
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/user_api.py +1 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/users_api.py +1 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/client.py +1 -1
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/utils/api.py +1 -1
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/LICENSE +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/LICENSE.AGPL +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/__init__.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/__init__.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/birdwatch_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/community_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/default_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/initial_state_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/post_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/tweet_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/user_list_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/v11_get_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/v11_post_api.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/models/__init__.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/models/base.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/models/header.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/models/initial_state.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/models/response.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/models/timeline.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/py.typed +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/tid.py +0 -0
- {twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/utils/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: twitter_openapi_python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Twitter OpenAPI
|
|
5
5
|
Keywords: twitter,api,python,scraper
|
|
6
6
|
Author: fa0311
|
|
@@ -8,7 +8,7 @@ Author-email: fa0311 <yuki@yuki0311.com>
|
|
|
8
8
|
License-Expression: LicenseRef-Custom OR AGPL-3.0-or-later
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
License-File: LICENSE.AGPL
|
|
11
|
-
Requires-Dist: twitter-openapi-python-generated==0.1.
|
|
11
|
+
Requires-Dist: twitter-openapi-python-generated==0.1.4
|
|
12
12
|
Requires-Dist: pydantic>=2.6
|
|
13
13
|
Requires-Dist: requests>=2.31.0,<3.0.0
|
|
14
14
|
Requires-Dist: urllib3>=2.1.0,<3.0.0
|
|
@@ -100,6 +100,19 @@ client.additional_api_headers = {
|
|
|
100
100
|
};
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
### Endpoint
|
|
104
|
+
|
|
105
|
+
The generated client accepts any host that keeps X's path shape (`/graphql/{queryId}/{operationName}`, `/1.1/...`, `/2/...` under `https://x.com/i/api`). Build the `ApiClient` yourself and hand it to `get_twitter_openapi_python_client`; the login helpers are not involved, so cookies and headers are then up to you (or to whatever answers at that host). For example, [twitter_api_safe_relay](https://github.com/fa0311/twitter_api_safe_relay) answers at `http://localhost:3000/i/api` with a logged-in browser session.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import twitter_openapi_python_generated as twitter
|
|
109
|
+
from twitter_openapi_python import TwitterOpenapiPython
|
|
110
|
+
|
|
111
|
+
api_client = twitter.ApiClient(twitter.Configuration(host="http://localhost:3000/i/api"))
|
|
112
|
+
client = TwitterOpenapiPython().get_twitter_openapi_python_client(api_client)
|
|
113
|
+
response = client.get_user_api().get_user_by_screen_name(screen_name="elonmusk")
|
|
114
|
+
```
|
|
115
|
+
|
|
103
116
|
## Development
|
|
104
117
|
|
|
105
118
|
```shell
|
|
@@ -81,6 +81,19 @@ client.additional_api_headers = {
|
|
|
81
81
|
};
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
### Endpoint
|
|
85
|
+
|
|
86
|
+
The generated client accepts any host that keeps X's path shape (`/graphql/{queryId}/{operationName}`, `/1.1/...`, `/2/...` under `https://x.com/i/api`). Build the `ApiClient` yourself and hand it to `get_twitter_openapi_python_client`; the login helpers are not involved, so cookies and headers are then up to you (or to whatever answers at that host). For example, [twitter_api_safe_relay](https://github.com/fa0311/twitter_api_safe_relay) answers at `http://localhost:3000/i/api` with a logged-in browser session.
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import twitter_openapi_python_generated as twitter
|
|
90
|
+
from twitter_openapi_python import TwitterOpenapiPython
|
|
91
|
+
|
|
92
|
+
api_client = twitter.ApiClient(twitter.Configuration(host="http://localhost:3000/i/api"))
|
|
93
|
+
client = TwitterOpenapiPython().get_twitter_openapi_python_client(api_client)
|
|
94
|
+
response = client.get_user_api().get_user_by_screen_name(screen_name="elonmusk")
|
|
95
|
+
```
|
|
96
|
+
|
|
84
97
|
## Development
|
|
85
98
|
|
|
86
99
|
```shell
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "twitter_openapi_python"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.4"
|
|
4
4
|
description = "Twitter OpenAPI"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "LicenseRef-Custom OR AGPL-3.0-or-later"
|
|
@@ -16,7 +16,7 @@ keywords = [
|
|
|
16
16
|
]
|
|
17
17
|
requires-python = ">=3.10"
|
|
18
18
|
dependencies = [
|
|
19
|
-
"twitter_openapi_python_generated==0.1.
|
|
19
|
+
"twitter_openapi_python_generated==0.1.4",
|
|
20
20
|
"pydantic>=2.6",
|
|
21
21
|
"requests>=2.31.0,<3.0.0",
|
|
22
22
|
"urllib3>=2.1.0,<3.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "twitter_openapi_python"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.4"
|
|
4
4
|
description = "Twitter OpenAPI"
|
|
5
5
|
authors = [{ name = "fa0311", email = "yuki@yuki0311.com" }]
|
|
6
6
|
readme = "README.md"
|
|
@@ -9,7 +9,7 @@ license-files = ["LICENSE", "LICENSE.AGPL"]
|
|
|
9
9
|
keywords = ["twitter", "api", "python", "scraper"]
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"twitter_openapi_python_generated==0.1.
|
|
12
|
+
"twitter_openapi_python_generated==0.1.4",
|
|
13
13
|
"pydantic>=2.6",
|
|
14
14
|
"requests>=2.31.0,<3.0.0",
|
|
15
15
|
"urllib3>=2.1.0,<3.0.0",
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/user_api.py
RENAMED
|
@@ -70,6 +70,7 @@ class UserApiUtils:
|
|
|
70
70
|
user_id: str,
|
|
71
71
|
extra_param: Optional[ParamType] = None,
|
|
72
72
|
) -> ResponseType:
|
|
73
|
+
"""Deprecated: X answers 403 outside a browser since 2026-10."""
|
|
73
74
|
param: ParamType = {"userId": user_id}
|
|
74
75
|
if extra_param is not None:
|
|
75
76
|
param.update(extra_param)
|
|
@@ -46,6 +46,7 @@ class UsersApiUtils:
|
|
|
46
46
|
user_ids: list[str],
|
|
47
47
|
extra_param: Optional[ParamType] = None,
|
|
48
48
|
) -> ResponseType:
|
|
49
|
+
"""Deprecated: X answers 403 outside a browser since 2026-10."""
|
|
49
50
|
param: ParamType = {"userIds": user_ids}
|
|
50
51
|
if extra_param is not None:
|
|
51
52
|
param.update(extra_param)
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/client.py
RENAMED
|
@@ -69,7 +69,7 @@ class TwitterOpenapiPythonClient:
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
class TwitterOpenapiPython:
|
|
72
|
-
hash: str = "
|
|
72
|
+
hash: str = "8535fd9baca301ede55b10da03495a7d413f5102"
|
|
73
73
|
placeholder_url = "https://raw.githubusercontent.com/fa0311/twitter-openapi/{hash}/src/config/placeholder.json"
|
|
74
74
|
header = "https://raw.githubusercontent.com/fa0311/latest-user-agent/refs/heads/main/header.json"
|
|
75
75
|
access_token: str = (
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/utils/api.py
RENAMED
|
@@ -196,7 +196,7 @@ def tweet_results_converter(tweetResults: models.ItemResult) -> Optional[models.
|
|
|
196
196
|
return properties
|
|
197
197
|
elif isinstance(properties, models.TweetWithVisibilityResults):
|
|
198
198
|
return properties.tweet
|
|
199
|
-
elif isinstance(properties, models.TweetTombstone):
|
|
199
|
+
elif isinstance(properties, (models.TweetTombstone, models.TweetUnavailable, models.TweetPreviewDisplay)):
|
|
200
200
|
return None
|
|
201
201
|
raise Exception()
|
|
202
202
|
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/__init__.py
RENAMED
|
File without changes
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/api/post_api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/models/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.1.3 → twitter_openapi_python-0.1.4}/twitter_openapi_python/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|