twitter-openapi-python 0.1.3__py3-none-any.whl → 0.1.4__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.
@@ -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)
@@ -69,7 +69,7 @@ class TwitterOpenapiPythonClient:
69
69
 
70
70
 
71
71
  class TwitterOpenapiPython:
72
- hash: str = "82d12f1e93e93cd283534f6abb4102bf7dc31c74"
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 = (
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: twitter_openapi_python
3
- Version: 0.1.3
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.3
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
@@ -6,12 +6,12 @@ twitter_openapi_python/api/default_api.py,sha256=Ca8OYS6TiYYVWo64QG-HUcmgog8FXwo
6
6
  twitter_openapi_python/api/initial_state_api.py,sha256=nAkb25-btWdMoSyyncxS_VrBQ9uKDgzmG7jBubfETYo,2269
7
7
  twitter_openapi_python/api/post_api.py,sha256=YSiGjV95AxxxSukZZESVRJ34D8hde6YRjd0Q6ElQ8fE,13166
8
8
  twitter_openapi_python/api/tweet_api.py,sha256=qaFin2czb9SObvEz_ObMG6NOf7e_Da90m7Pkckon7rM,24226
9
- twitter_openapi_python/api/user_api.py,sha256=zZFczuDwm7izp_WGFEgNTL4RQyN1aRPSijFTa8hZ_OI,5176
9
+ twitter_openapi_python/api/user_api.py,sha256=DdNQHQUThdRA_ODFfEJVR3hJloU3_iOJQwlX1YW-Wxw,5249
10
10
  twitter_openapi_python/api/user_list_api.py,sha256=dCp_K0bIC0CBn_kI5B8hpKy0TVhZgET4zpfadc_TrZ0,13471
11
- twitter_openapi_python/api/users_api.py,sha256=_vLDKAu5RfvPVwBeOcFpuSUd47fAgLjTLVK40dJuLMQ,3170
11
+ twitter_openapi_python/api/users_api.py,sha256=edfkhsQ6y3GdaMuTl7XEX22NBXWqn8J9zTBDyPe9cTU,3243
12
12
  twitter_openapi_python/api/v11_get_api.py,sha256=UXe34f6IBYExqWCJ8HCld_8d_ChQb92je0G5VtLxmyM,1978
13
13
  twitter_openapi_python/api/v11_post_api.py,sha256=eErGBOo-y4E1AAMIHgeWnc0rAFmc5KgIoipJI-8V0Y8,1781
14
- twitter_openapi_python/client.py,sha256=Ra44Oxc-DfU_Jar93nXndVF_xjbPkYlCtT3JxAy5L_M,7126
14
+ twitter_openapi_python/client.py,sha256=FNPxbYLaYnxEUfZ2KxNVb4ebXxTgNmwuS6XDn2BOH6o,7126
15
15
  twitter_openapi_python/models/__init__.py,sha256=pHISZJrEPBlXS25kMydl1SxXuCct-CUpnPDfL7kEEBo,588
16
16
  twitter_openapi_python/models/base.py,sha256=3sw6wdQn9i8FoujFxhEFVWIB26-qjI6JTDuXKuebM0Y,189
17
17
  twitter_openapi_python/models/header.py,sha256=EKujtBRZOJmeh2SD1QOCsLWaE9gdGY4wsNUgwCnbTCU,644
@@ -21,9 +21,9 @@ twitter_openapi_python/models/timeline.py,sha256=dRMoc7zqyW_E2iehs4F6HfX8Iy_1b-e
21
21
  twitter_openapi_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  twitter_openapi_python/tid.py,sha256=xjqJMyPOp62nw2MQjMGHaB4L6G6OZHuWkMR-WKJo7aU,1120
23
23
  twitter_openapi_python/utils/__init__.py,sha256=lIEPoDqtgCvUk0A8cWqdTlTWMhkEp_NbVxL7sJ0uiu8,612
24
- twitter_openapi_python/utils/api.py,sha256=ytdYSv08LYGCe8gof4DptzhjCkgIBV1uJmJXC9htQnU,12623
25
- twitter_openapi_python-0.1.3.dist-info/licenses/LICENSE,sha256=sLv8EMhrPCMG_LeweYvYKS_B-cDMBwBSKZel7LSMGAs,1493
26
- twitter_openapi_python-0.1.3.dist-info/licenses/LICENSE.AGPL,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
27
- twitter_openapi_python-0.1.3.dist-info/WHEEL,sha256=9IUYslYuG_asT4WlWvfk_K76nveuLvSTKDoLeL0cV-Q,80
28
- twitter_openapi_python-0.1.3.dist-info/METADATA,sha256=yjdR3DLGE3SoEu6yuHgaoAgweBEwicaBYLfIi3-PaFk,3232
29
- twitter_openapi_python-0.1.3.dist-info/RECORD,,
24
+ twitter_openapi_python/utils/api.py,sha256=pB8HxigbImUPb-dN0skQM8Am1jPEybhX9KUioJZzL50,12678
25
+ twitter_openapi_python-0.1.4.dist-info/licenses/LICENSE,sha256=sLv8EMhrPCMG_LeweYvYKS_B-cDMBwBSKZel7LSMGAs,1493
26
+ twitter_openapi_python-0.1.4.dist-info/licenses/LICENSE.AGPL,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
27
+ twitter_openapi_python-0.1.4.dist-info/WHEEL,sha256=3NO1oYsF7mANFUWVdyEQLM-zmecczWWEmmF5rEbXrWk,80
28
+ twitter_openapi_python-0.1.4.dist-info/METADATA,sha256=19fM08JkjkVq2dyC5srB3R3q0nsfPzizIBU6z2WM1XU,4136
29
+ twitter_openapi_python-0.1.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.13.1
2
+ Generator: uv 0.13.6
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any