tweetapi 1.0.0__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,277 @@
1
+ Metadata-Version: 2.4
2
+ Name: tweetapi
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for TweetAPI — Twitter/X Data API for developers and researchers
5
+ Project-URL: Homepage, https://tweetapi.com?utm_source=pypi&utm_medium=readme&utm_campaign=python-sdk
6
+ Project-URL: Documentation, https://tweetapi.com/docs?utm_source=pypi&utm_medium=readme&utm_campaign=python-sdk
7
+ Project-URL: Repository, https://github.com/tweetapi/tweetapi-python
8
+ Project-URL: Issues, https://github.com/tweetapi/tweetapi-python/issues
9
+ Author-email: TweetAPI <support@tweetapi.com>
10
+ License-Expression: MIT
11
+ Keywords: social media api,tweet api,tweetapi,tweets,twitter,twitter api,twitter client,twitter data,twitter library,twitter sdk,twitter wrapper,x api
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Internet :: WWW/HTTP
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.9
25
+ Requires-Dist: requests>=2.28.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0; extra == 'dev'
28
+ Requires-Dist: responses>=0.23.0; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # TweetAPI Python SDK
32
+
33
+ Official Python SDK for [TweetAPI](https://tweetapi.com?utm_source=github&utm_medium=readme&utm_campaign=python-sdk) — the Twitter/X Data API for developers and researchers.
34
+
35
+ Access tweets, user profiles, followers, analytics, and full interaction capabilities. 70+ endpoints with built-in error handling and type hints.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install tweetapi
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ ```python
46
+ from tweetapi import TweetAPI
47
+
48
+ client = TweetAPI(api_key="YOUR_API_KEY")
49
+
50
+ # Get a user profile
51
+ user = client.user.get_by_username(username="elonmusk")
52
+ print(user["data"]["followerCount"]) # 180000000
53
+
54
+ # Search tweets
55
+ results = client.explore.search(query="bitcoin", type="Latest")
56
+
57
+ # Get followers with pagination
58
+ followers = client.user.get_followers(user_id="123456")
59
+ next_page = client.user.get_followers(
60
+ user_id="123456",
61
+ cursor=followers["pagination"]["nextCursor"],
62
+ )
63
+ ```
64
+
65
+ > **Get your free API key** — [100 requests, no credit card required](https://tweetapi.com?utm_source=github&utm_medium=readme&utm_campaign=python-sdk)
66
+
67
+ ## Features
68
+
69
+ - **70+ endpoints** covering users, tweets, posts, interactions, DMs, communities, spaces, and search
70
+ - **Full type hints** with TypedDict definitions for IDE autocomplete
71
+ - **Solid error handling** with typed exceptions (`RateLimitError`, `NotFoundError`, etc.)
72
+ - **Single dependency** — `requests` only
73
+ - **Pagination support** with cursor-based navigation
74
+ - **Python 3.9+** compatible
75
+
76
+ ## API Reference
77
+
78
+ ### User
79
+
80
+ | Method | Description |
81
+ |--------|-------------|
82
+ | `client.user.get_by_username(username=...)` | Get user profile by username |
83
+ | `client.user.get_by_usernames(usernames=...)` | Get multiple users (comma-separated) |
84
+ | `client.user.get_by_user_id(user_id=...)` | Get user profile by ID |
85
+ | `client.user.get_by_user_ids(user_ids=...)` | Get multiple users by IDs |
86
+ | `client.user.get_tweets(user_id=...)` | Get a user's tweets |
87
+ | `client.user.get_tweets_and_replies(user_id=...)` | Get tweets and replies |
88
+ | `client.user.get_following(user_id=...)` | Get who a user follows |
89
+ | `client.user.get_followers(user_id=...)` | Get a user's followers |
90
+ | `client.user.get_verified_followers(user_id=...)` | Get verified followers |
91
+ | `client.user.get_subscriptions(user_id=...)` | Get subscriptions |
92
+ | `client.user.get_following_v1(user_id=...)` | Get following (v1, supports count) |
93
+ | `client.user.get_followers_v1(user_id=...)` | Get followers (v1, supports count) |
94
+ | `client.user.get_following_ids(user_id=...)` | Get following user IDs |
95
+ | `client.user.get_followers_ids(user_id=...)` | Get follower user IDs |
96
+ | `client.user.check_follow(subject_id=..., target_id=...)` | Check follow relationship |
97
+ | `client.user.about_account(username=...)` | Get account transparency info |
98
+
99
+ ### Tweet
100
+
101
+ | Method | Description |
102
+ |--------|-------------|
103
+ | `client.tweet.get_details_and_conversation(tweet_id=...)` | Get tweet details and replies |
104
+ | `client.tweet.get_details_by_ids(ids=...)` | Get multiple tweets (max 200) |
105
+ | `client.tweet.get_retweets(tweet_id=...)` | Get who retweeted |
106
+ | `client.tweet.get_quotes(tweet_id=...)` | Get quote tweets |
107
+ | `client.tweet.translate(tweet_id=..., dst_lang=...)` | Translate a tweet |
108
+
109
+ ### Post
110
+
111
+ | Method | Description |
112
+ |--------|-------------|
113
+ | `client.post.create_post(auth_token=..., text=..., proxy=...)` | Create a tweet |
114
+ | `client.post.create_post_quote(auth_token=..., text=..., attachment_url=..., proxy=...)` | Quote tweet |
115
+ | `client.post.create_post_with_media(auth_token=..., text=..., media=..., proxy=...)` | Tweet with media |
116
+ | `client.post.reply_post(auth_token=..., text=..., tweet_id=..., proxy=...)` | Reply to a tweet |
117
+ | `client.post.reply_post_with_media(...)` | Reply with media |
118
+ | `client.post.delete_post(auth_token=..., tweet_id=...)` | Delete a tweet |
119
+
120
+ ### Interaction
121
+
122
+ | Method | Description |
123
+ |--------|-------------|
124
+ | `client.interaction.favorite_post(auth_token=..., tweet_id=...)` | Like a tweet |
125
+ | `client.interaction.unfavorite_post(auth_token=..., tweet_id=...)` | Unlike a tweet |
126
+ | `client.interaction.retweet(auth_token=..., tweet_id=...)` | Retweet |
127
+ | `client.interaction.delete_retweet(auth_token=..., tweet_id=...)` | Remove retweet |
128
+ | `client.interaction.bookmark(auth_token=..., tweet_id=...)` | Bookmark a tweet |
129
+ | `client.interaction.delete_bookmark(auth_token=..., tweet_id=...)` | Remove bookmark |
130
+ | `client.interaction.follow(auth_token=..., user_id=...)` | Follow a user |
131
+ | `client.interaction.unfollow(auth_token=..., user_id=...)` | Unfollow a user |
132
+ | `client.interaction.add_member_to_list(auth_token=..., list_id=..., user_id=...)` | Add to list |
133
+ | `client.interaction.remove_member_from_list(auth_token=..., list_id=..., user_id=...)` | Remove from list |
134
+ | `client.interaction.get_notifications(auth_token=...)` | Get notifications |
135
+ | `client.interaction.get_user_analytics(auth_token=...)` | Get analytics |
136
+
137
+ ### List
138
+
139
+ | Method | Description |
140
+ |--------|-------------|
141
+ | `client.list.get_details(list_id=...)` | Get list details |
142
+ | `client.list.get_tweets(list_id=...)` | Get tweets in a list |
143
+ | `client.list.get_members(list_id=...)` | Get list members |
144
+ | `client.list.get_followers(list_id=...)` | Get list followers |
145
+
146
+ ### Community
147
+
148
+ | Method | Description |
149
+ |--------|-------------|
150
+ | `client.community.get_details(community_id=...)` | Get community details |
151
+ | `client.community.get_tweets(community_id=..., sort_by=...)` | Get community tweets |
152
+ | `client.community.get_members(community_id=...)` | Get members |
153
+ | `client.community.search(query=...)` | Search communities |
154
+ | `client.community.create_post(auth_token=..., text=..., community_id=..., proxy=...)` | Post in community |
155
+ | `client.community.create_post_with_media(...)` | Post with media |
156
+ | `client.community.reply_post(...)` | Reply to community post |
157
+ | `client.community.reply_post_with_media(...)` | Reply with media |
158
+ | `client.community.join(auth_token=..., community_id=...)` | Join |
159
+ | `client.community.leave(auth_token=..., community_id=...)` | Leave |
160
+
161
+ ### Space
162
+
163
+ | Method | Description |
164
+ |--------|-------------|
165
+ | `client.space.get_by_id(space_id=...)` | Get Space details |
166
+ | `client.space.get_stream_url(media_key=...)` | Get HLS stream URL |
167
+
168
+ ### Explore
169
+
170
+ | Method | Description |
171
+ |--------|-------------|
172
+ | `client.explore.search(query=..., type=...)` | Search tweets/users/photos/videos |
173
+
174
+ ### Auth
175
+
176
+ | Method | Description |
177
+ |--------|-------------|
178
+ | `client.auth.login(username=..., password=..., proxy=...)` | Log in, get auth tokens |
179
+
180
+ ### X Chat (Encrypted DMs)
181
+
182
+ | Method | Description |
183
+ |--------|-------------|
184
+ | `client.xchat.setup(auth_token=..., user_id=..., pin=...)` | Initialize encrypted DMs |
185
+ | `client.xchat.get_conversations(auth_token=...)` | List conversations |
186
+ | `client.xchat.send(auth_token=..., recipient_id=..., message=...)` | Send message |
187
+ | `client.xchat.get_history(auth_token=..., conversation_id=...)` | Get history |
188
+ | `client.xchat.can_dm(auth_token=..., user_ids=...)` | Check DM availability |
189
+
190
+ ### Unencrypted DMs
191
+
192
+ | Method | Description |
193
+ |--------|-------------|
194
+ | `client.dm.send_dm(auth_token=..., conversation_id=..., text=..., proxy=...)` | Send DM |
195
+ | `client.dm.get_dm_permissions(auth_token=..., recipient_ids=...)` | Check permissions |
196
+ | `client.dm.get_inbox_initial_state(auth_token=...)` | Get inbox state |
197
+ | `client.dm.get_inbox_trusted(auth_token=..., cursor=...)` | Trusted inbox |
198
+ | `client.dm.get_inbox_untrusted(auth_token=..., cursor=...)` | Message requests |
199
+ | `client.dm.get_conversation(auth_token=..., conversation_id=...)` | Get messages |
200
+ | `client.dm.get_dm_user_updates(auth_token=..., cursor=...)` | DM user updates |
201
+ | `client.dm.accept_conversation(auth_token=..., conversation_id=...)` | Accept request |
202
+
203
+ ## Error Handling
204
+
205
+ The SDK throws typed exceptions you can catch and handle:
206
+
207
+ ```python
208
+ import time
209
+ from tweetapi import (
210
+ TweetAPI,
211
+ TweetAPIError,
212
+ AuthenticationError,
213
+ RateLimitError,
214
+ NotFoundError,
215
+ ValidationError,
216
+ ServerError,
217
+ NetworkError,
218
+ )
219
+
220
+ client = TweetAPI(api_key="YOUR_API_KEY")
221
+
222
+ try:
223
+ user = client.user.get_by_username(username="elonmusk")
224
+ except RateLimitError as e:
225
+ # Wait and retry
226
+ print(f"Rate limited. Retry in {e.retry_after}s")
227
+ time.sleep(e.retry_after)
228
+ except NotFoundError:
229
+ print("User not found")
230
+ except AuthenticationError:
231
+ print("Invalid API key")
232
+ except ValidationError as e:
233
+ print(f"Bad request: {e.message}")
234
+ except ServerError:
235
+ print("API is having issues, try again later")
236
+ except NetworkError:
237
+ print("Network error — check your connection")
238
+ except TweetAPIError as e:
239
+ # Catch-all for any other API error
240
+ print(f"Error [{e.code}]: {e.message}")
241
+ ```
242
+
243
+ Every error includes:
244
+ - `code` — API error code (e.g., `"ACCOUNT_SUSPENDED"`, `"RATE_LIMIT"`)
245
+ - `status_code` — HTTP status code
246
+ - `message` — Human-readable error message
247
+ - `details` — Additional context (field, reason, retry_after, etc.)
248
+
249
+ ## Configuration
250
+
251
+ ```python
252
+ client = TweetAPI(
253
+ api_key="YOUR_API_KEY", # Required
254
+ base_url="https://...", # Optional (default: https://api.tweetapi.com)
255
+ timeout=30, # Optional (default: 30 seconds)
256
+ )
257
+ ```
258
+
259
+ ## Requirements
260
+
261
+ - Python 3.9+
262
+ - `requests` library
263
+
264
+ ## Links
265
+
266
+ - [Full Documentation](https://tweetapi.com/docs?utm_source=github&utm_medium=readme&utm_campaign=python-sdk)
267
+ - [Get API Key (Free)](https://tweetapi.com?utm_source=github&utm_medium=readme&utm_campaign=python-sdk)
268
+ - [Dashboard](https://tweetapi.com/dashboard?utm_source=github&utm_medium=readme&utm_campaign=python-sdk)
269
+ - [Node.js SDK](https://github.com/tweetapi/tweetapi-node)
270
+
271
+ ## License
272
+
273
+ MIT
274
+
275
+ ---
276
+
277
+ *TweetAPI is a third-party service and is not affiliated with X Corp.*
@@ -0,0 +1,20 @@
1
+ tweetapi/__init__.py,sha256=7VhOdfR4sqlbGm2K9pxJBWc0keLCTXhICJU2bJLKZI8,730
2
+ tweetapi/client.py,sha256=q2AGn3683D6k9bd-xXwxYrGI3Q5CmHqmBMlJCMaQSS4,4934
3
+ tweetapi/errors.py,sha256=TGjIUVGHddPSBJ5pzLu8Ce9yEPC2I4qO8FB2IvjRb5s,3252
4
+ tweetapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ tweetapi/types.py,sha256=AU4Yg0FmKklZSuul4sP6QeyPSySBG644RxHw5oawu4c,12002
6
+ tweetapi/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ tweetapi/resources/auth.py,sha256=gNDxP9rN0KvY1PZVyKjMUY7JaUOp3zdvpU6y7YJ7riI,618
8
+ tweetapi/resources/community.py,sha256=dPhJn4MNPDJWaRdOKIn4dTM4Q7wYqdW_EMs1G_kUp8U,3763
9
+ tweetapi/resources/explore.py,sha256=zrrQYoyJ4wqU7bYJWwCq4Co3eC2kAar8y1LpnyRW3Gk,754
10
+ tweetapi/resources/interaction.py,sha256=Nc9cq-YRZbgQUjX58GuC07wVFnw4HRYpzFwAZ7r6dYU,4303
11
+ tweetapi/resources/list_.py,sha256=HqYTcrxeBoRmaSZvDfgZzjUk7zPQ0vLQ3FilVbiorE8,1089
12
+ tweetapi/resources/post.py,sha256=iK4kheEwdqhPEsB47uGguPyuTjUBf0HDxXJDwb_L8rE,2680
13
+ tweetapi/resources/space.py,sha256=LbVl7PphJKW7MwI5NZFvsA6Xvt48n_dPcIF07Pp-ykQ,612
14
+ tweetapi/resources/tweet.py,sha256=Qb6EmcmKF_oFUndQDhFfE18UeBNGQzEgo3TP4lM8aJU,1494
15
+ tweetapi/resources/unencrypted_dm.py,sha256=wVyPUm0gNV5YHeHylWt0HHgcktrp_pfBnOCxOmNQU3Y,3244
16
+ tweetapi/resources/user.py,sha256=Ab9MRfrf7lfgK_C8a4E8V9XjBIZWK_hRw63yyGkjcaI,4246
17
+ tweetapi/resources/xchat.py,sha256=kvia6_l40DiitvTCTcVrPLTcs7ef6pyseuB-6HJI3t4,2124
18
+ tweetapi-1.0.0.dist-info/METADATA,sha256=V1QRkCl5WqhEeIi6D6GEKr5cV50_Rfc9PGsB9V2QTnc,11302
19
+ tweetapi-1.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
20
+ tweetapi-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any