twitter-openapi-python 0.0.13__tar.gz → 0.0.15__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.13 → twitter_openapi_python-0.0.15}/PKG-INFO +1 -1
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/pyproject.toml +2 -2
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/setup.py +1 -1
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/client.py +2 -2
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/utils/api.py +39 -14
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python.egg-info/PKG-INFO +1 -1
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/LICENSE +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/LICENSE.AGPL +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/README.md +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/setup.cfg +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/__init__.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/__init__.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/default_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/initial_state_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/post_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/tweet_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/user_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/user_list_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/users_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/v11_get_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/api/v11_post_api.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/models/__init__.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/models/base.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/models/header.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/models/initial_state.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/models/response.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/models/timeline.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/py.typed +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/utils/__init__.py +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python.egg-info/SOURCES.txt +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python.egg-info/dependency_links.txt +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python.egg-info/requires.txt +0 -0
- {twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/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.15"
|
|
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 = ">=2.6"
|
|
16
16
|
|
|
17
|
-
twitter-openapi-python-generated = "0.0.
|
|
17
|
+
twitter-openapi-python-generated = "0.0.11"
|
|
18
18
|
|
|
19
19
|
[tool.poetry.dev-dependencies]
|
|
20
20
|
|
{twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/client.py
RENAMED
|
@@ -110,8 +110,8 @@ class TwitterOpenapiPython:
|
|
|
110
110
|
api: twitter.ApiClient,
|
|
111
111
|
) -> TwitterOpenapiPythonClient:
|
|
112
112
|
http = urllib3.PoolManager()
|
|
113
|
-
flag = http.request("GET", self.placeholder_url.format(hash=self.hash))
|
|
114
|
-
return TwitterOpenapiPythonClient(api, flag)
|
|
113
|
+
flag = http.request("GET", self.placeholder_url.format(hash=self.hash))
|
|
114
|
+
return TwitterOpenapiPythonClient(api, json.loads(flag.data))
|
|
115
115
|
|
|
116
116
|
def get_client_from_cookies(
|
|
117
117
|
self,
|
{twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/utils/api.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from typing import Any, Dict, List, Optional, TypeGuard, TypeVar
|
|
2
|
+
from typing import Any, Dict, List, Mapping, Optional, TypeGuard, TypeVar
|
|
3
3
|
|
|
4
4
|
import twitter_openapi_python_generated as twitter
|
|
5
5
|
import twitter_openapi_python_generated.models as models
|
|
@@ -83,35 +83,55 @@ def instruction_to_entry(
|
|
|
83
83
|
def tweet_entries_converter(
|
|
84
84
|
input: List[models.TimelineAddEntry],
|
|
85
85
|
) -> List[TweetApiUtilsData]:
|
|
86
|
-
def map_fn(x: models.TimelineAddEntry) -> Optional[TweetApiUtilsData]:
|
|
86
|
+
def map_fn(x: models.TimelineAddEntry) -> Optional[List[TweetApiUtilsData]]:
|
|
87
87
|
one_of = x.content.actual_instance
|
|
88
88
|
|
|
89
89
|
if isinstance(one_of, models.TimelineTimelineItem):
|
|
90
90
|
item = one_of.item_content.actual_instance
|
|
91
91
|
if isinstance(item, models.TimelineTweet):
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
return non_nullable_list(
|
|
93
|
+
[
|
|
94
|
+
build_tweet_api_utils(
|
|
95
|
+
result=item.tweet_results,
|
|
96
|
+
promoted_metadata=item.promoted_metadata,
|
|
97
|
+
reply=[],
|
|
98
|
+
)
|
|
99
|
+
]
|
|
96
100
|
)
|
|
97
101
|
elif isinstance(one_of, models.TimelineTimelineModule):
|
|
98
102
|
module = one_of.items or []
|
|
99
103
|
timelineList = non_nullable_list(list(map(map_fn_2, module)))
|
|
100
104
|
if len(timelineList) == 0:
|
|
101
105
|
return None
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
if one_of.display_type == models.DisplayType.VERTICALGRID:
|
|
107
|
+
return non_nullable_list(
|
|
108
|
+
[
|
|
109
|
+
build_tweet_api_utils(
|
|
110
|
+
result=x.tweet_results,
|
|
111
|
+
promoted_metadata=x.promoted_metadata,
|
|
112
|
+
reply=[],
|
|
113
|
+
)
|
|
114
|
+
for x in timelineList
|
|
115
|
+
]
|
|
116
|
+
)
|
|
117
|
+
else:
|
|
118
|
+
timeline = timelineList[0]
|
|
119
|
+
return non_nullable_list(
|
|
120
|
+
[
|
|
121
|
+
build_tweet_api_utils(
|
|
122
|
+
result=timeline.tweet_results,
|
|
123
|
+
promoted_metadata=timeline.promoted_metadata,
|
|
124
|
+
reply=timelineList[1:],
|
|
125
|
+
)
|
|
126
|
+
]
|
|
127
|
+
)
|
|
108
128
|
|
|
109
129
|
def map_fn_2(x: models.ModuleItem) -> Optional[models.TimelineTweet]:
|
|
110
130
|
item = x.item.item_content.actual_instance
|
|
111
131
|
if isinstance(item, models.TimelineTweet):
|
|
112
132
|
return item
|
|
113
133
|
|
|
114
|
-
return non_nullable_list(list(map(map_fn, input)))
|
|
134
|
+
return flat(non_nullable_list(list(map(map_fn, input))))
|
|
115
135
|
|
|
116
136
|
|
|
117
137
|
def user_or_null_converter(user: models.UserUnion) -> Optional[models.User]:
|
|
@@ -245,7 +265,12 @@ def build_response(
|
|
|
245
265
|
if response.headers is None:
|
|
246
266
|
raise Exception("headers is None")
|
|
247
267
|
|
|
248
|
-
|
|
268
|
+
if isinstance(response.headers, Dict):
|
|
269
|
+
header = build_header(response.headers)
|
|
270
|
+
elif isinstance(response.headers, Mapping):
|
|
271
|
+
header = build_header(dict(response.headers))
|
|
272
|
+
else:
|
|
273
|
+
raise Exception("headers is not a dict")
|
|
249
274
|
|
|
250
275
|
return TwitterApiUtilsResponse(
|
|
251
276
|
raw=TwitterApiUtilsRaw(response=response),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{twitter_openapi_python-0.0.13 → twitter_openapi_python-0.0.15}/twitter_openapi_python/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|