twitter-openapi-python 0.0.9__tar.gz → 0.0.12__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.0.9 → twitter_openapi_python-0.0.12}/PKG-INFO +1 -1
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/pyproject.toml +2 -2
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/setup.py +1 -1
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/client.py +23 -6
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python.egg-info/PKG-INFO +1 -1
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/LICENSE +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/LICENSE.AGPL +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/README.md +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/setup.cfg +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/__init__.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/__init__.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/default_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/initial_state_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/post_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/tweet_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/user_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/user_list_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/users_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/v11_get_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/api/v11_post_api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/models/__init__.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/models/base.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/models/header.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/models/initial_state.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/models/response.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/models/timeline.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/py.typed +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/utils/__init__.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/utils/api.py +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python.egg-info/SOURCES.txt +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python.egg-info/dependency_links.txt +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python.egg-info/requires.txt +0 -0
- {twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "twitter_openapi_python"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.12"
|
|
4
4
|
description = "Twitter OpenAPI"
|
|
5
5
|
authors = ["fa0311 <yuki@yuki0311.com>"]
|
|
6
6
|
license = "proprietary" # or "AGPL-3.0-only"
|
|
@@ -14,7 +14,7 @@ include = ["twitter_openapi_python/py.typed"]
|
|
|
14
14
|
python = "^3.7"
|
|
15
15
|
pydantic = "^1.10.5, <2"
|
|
16
16
|
|
|
17
|
-
twitter-openapi-python-generated = "0.0.
|
|
17
|
+
twitter-openapi-python-generated = "0.0.7"
|
|
18
18
|
|
|
19
19
|
[tool.poetry.dev-dependencies]
|
|
20
20
|
|
{twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/client.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import json
|
|
2
2
|
import re
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
@@ -120,12 +120,10 @@ class TwitterOpenapiPython:
|
|
|
120
120
|
|
|
121
121
|
if cookies.get("ct0"):
|
|
122
122
|
api_key.update({"AuthType": "OAuth2Session"})
|
|
123
|
-
|
|
124
|
-
api_key.update({"CsrfToken": ct0})
|
|
123
|
+
api_key.update({"CsrfToken": cookies["ct0"]})
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
api_key.update({"GuestToken": gt})
|
|
125
|
+
if cookies.get("gt"):
|
|
126
|
+
api_key.update({"GuestToken": cookies["gt"]})
|
|
129
127
|
|
|
130
128
|
api_conf = conf.Configuration(api_key=api_key)
|
|
131
129
|
api_conf.access_token = self.access_token
|
|
@@ -157,4 +155,23 @@ class TwitterOpenapiPython:
|
|
|
157
155
|
|
|
158
156
|
find = re.findall(r'document.cookie="(.*?)";', res_2.data.decode())
|
|
159
157
|
session.update(self.cookie_normalize(find))
|
|
158
|
+
|
|
159
|
+
session.pop("ct0")
|
|
160
|
+
|
|
161
|
+
if not session.get("gt"):
|
|
162
|
+
activate_header = self.browser_headers | {
|
|
163
|
+
"authorization": "Bearer {}".format(self.access_token),
|
|
164
|
+
"x-twitter-active-user": "yes",
|
|
165
|
+
"x-twitter-client-language": "en",
|
|
166
|
+
}
|
|
167
|
+
res_3 = http.request(
|
|
168
|
+
"POST",
|
|
169
|
+
"https://api.twitter.com/1.1/guest/activate.json",
|
|
170
|
+
headers=activate_header | {"Cookie": self.cookie_to_str(session)},
|
|
171
|
+
)
|
|
172
|
+
gt = json.loads(res_3.data.decode())["guest_token"]
|
|
173
|
+
session.update({"gt": gt})
|
|
174
|
+
|
|
175
|
+
# ct0 = cookies.get("ct0", "".join(random.choices("0123456789abcdef", k=32)))
|
|
176
|
+
|
|
160
177
|
return self.get_client_from_cookies(session)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/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.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.0.9 → twitter_openapi_python-0.0.12}/twitter_openapi_python/utils/api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|