twitter-openapi-python 0.0.24__py3-none-any.whl → 0.0.25__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.
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.1
2
+ Name: twitter-openapi-python
3
+ Version: 0.0.25
4
+ Summary: Twitter OpenAPI
5
+ Home-page: https://github.com/fa0311/twitter_openapi_python
6
+ Author: fa0311
7
+ Author-email: yuki@yuki0311.com
8
+ License: proprietary or AGPL-3.0-or-later
9
+ Keywords: OpenAPI,OpenAPI-Generator,Twitter OpenAPI
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ License-File: LICENSE.AGPL
13
+ Requires-Dist: twitter-openapi-python-generated ==0.0.21
14
+ Requires-Dist: pydantic >=2.6
15
+
16
+ # twitter_openapi_python
17
+
18
+ Twitter scraping with data validation by pydantic.
19
+
20
+ ![1691572735537](https://raw.githubusercontent.com/fa0311/twitter_openapi_python/refs/heads/master/twitter_openapi_python/docs/image/README/1691572735537.png)
21
+
22
+ ## Setup
23
+
24
+ ```shell
25
+ pip install twitter-openapi-python
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```python
31
+ import json
32
+ import datetime
33
+
34
+ from pathlib import Path
35
+ from tweepy_authlib import CookieSessionUserHandler
36
+ from twitter_openapi_python import TwitterOpenapiPython
37
+
38
+ # login by tweepy_authlib
39
+ if Path("cookie.json").exists():
40
+ with open("cookie.json", "r") as f:
41
+ cookies_dict = json.load(f)
42
+ if isinstance(cookies_dict, list):
43
+ cookies_dict = {k["name"]: k["value"] for k in cookies_dict}
44
+ else:
45
+ auth_handler = CookieSessionUserHandler(
46
+ screen_name=input("screen_name: "),
47
+ password=input("password: "),
48
+ )
49
+ cookies_dict = auth_handler.get_cookies().get_dict()
50
+
51
+ # get client from cookies
52
+ 撫 = TwitterOpenapiPython().get_client_from_cookies(cookies=cookies_dict)
53
+
54
+ # tweet "Hello World!!" with current time
55
+ time = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
56
+ 撫.get_post_api().post_create_tweet(tweet_text=f"Hello World!!{time}")
57
+
58
+ # get user info
59
+ response = 撫.get_user_api().get_user_by_screen_name("elonmusk")
60
+ ```
61
+
62
+ ### Login
63
+
64
+ ```python
65
+ from twitter_openapi_python import TwitterOpenapiPython
66
+
67
+ # guest client
68
+ 撫 = TwitterOpenapiPython().get_guest_client()
69
+ tweet = 撫.get_default_api().get_tweet_result_by_rest_id("1349129669258448897")
70
+ assert tweet.data is not None
71
+ assert tweet.data.tweet.legacy is not None
72
+ print(tweet.data.tweet.legacy.full_text)
73
+ ```
74
+
75
+ ### Multiple OS
76
+
77
+ The Token can only be used on the same OS that issued the Token
78
+ In other words, if the sec-ch-ua-platform does not match, the Token cannot be used.
79
+ This library uses the Linux Chrome header by default.
80
+ To use Token issued by Windows, do the following.
81
+
82
+ ```typescript
83
+ TwitterOpenapiPython.additional_api_headers = {
84
+ "sec-ch-ua-platform": '"Windows"',
85
+ };
86
+ ```
87
+
88
+ ## License
89
+
90
+ This project is dual licensed. You can choose one of the following licenses:
91
+
92
+ - [Custom License](./LICENSE)
93
+ - [GNU Affero General Public License v3.0](./LICENSE.AGPL)
@@ -19,9 +19,9 @@ twitter_openapi_python/models/response.py,sha256=ZuaX36mKRsVx5aiJhNw3CjrvVGVaGjM
19
19
  twitter_openapi_python/models/timeline.py,sha256=AoWfrJsonYImlweciaUSjFzmeciaX0zshi7d-FkT4LM,1392
20
20
  twitter_openapi_python/utils/__init__.py,sha256=QVT1eCClP9EVfcZ4QU96TVegfAUDEtJ-PVp3zv6qy6w,449
21
21
  twitter_openapi_python/utils/api.py,sha256=JTSXE1Wh3AiuOb_APTDTQMrR4HTkI9AihzrXkJGV2d8,10026
22
- twitter_openapi_python-0.0.24.dist-info/LICENSE,sha256=xthyYzrtSmRlBu2gnfuIxzsZeHrqtIZgZPL9UPrYiQU,1524
23
- twitter_openapi_python-0.0.24.dist-info/LICENSE.AGPL,sha256=Nv6u1ubULm-E2y6q2-pQPK8s2BzkOltLaVlPKQ3tkcs,35182
24
- twitter_openapi_python-0.0.24.dist-info/METADATA,sha256=gAfBFLyf8j_Nb0LtsAPTmWrRdaG62cbE7WdveewWmsU,551
25
- twitter_openapi_python-0.0.24.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
26
- twitter_openapi_python-0.0.24.dist-info/top_level.txt,sha256=wKFCnW_S6aWD3nFPmd65SxZIviiqQ30LqHOLLpcnTdE,23
27
- twitter_openapi_python-0.0.24.dist-info/RECORD,,
22
+ twitter_openapi_python-0.0.25.dist-info/LICENSE,sha256=xthyYzrtSmRlBu2gnfuIxzsZeHrqtIZgZPL9UPrYiQU,1524
23
+ twitter_openapi_python-0.0.25.dist-info/LICENSE.AGPL,sha256=Nv6u1ubULm-E2y6q2-pQPK8s2BzkOltLaVlPKQ3tkcs,35182
24
+ twitter_openapi_python-0.0.25.dist-info/METADATA,sha256=DBxA123_stiz681r3-Ttb4UfWg5cYuP0SKy-KLjnHmc,2769
25
+ twitter_openapi_python-0.0.25.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
26
+ twitter_openapi_python-0.0.25.dist-info/top_level.txt,sha256=wKFCnW_S6aWD3nFPmd65SxZIviiqQ30LqHOLLpcnTdE,23
27
+ twitter_openapi_python-0.0.25.dist-info/RECORD,,
@@ -1,17 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: twitter-openapi-python
3
- Version: 0.0.24
4
- Summary: Twitter OpenAPI
5
- Home-page: https://github.com/fa0311/twitter_openapi_python
6
- Author: fa0311
7
- Author-email: yuki@yuki0311.com
8
- License: proprietary or AGPL-3.0-or-later
9
- Keywords: OpenAPI,OpenAPI-Generator,Twitter OpenAPI
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- License-File: LICENSE.AGPL
13
- Requires-Dist: twitter-openapi-python-generated ==0.0.21
14
- Requires-Dist: pydantic >=2.6
15
-
16
- Twitter scraping with data validation by pydantic.
17
-