Skip to content

Commit 0f3df5e

Browse files
committed
feat(users): ✨ add ratelimit for search users and trends
1 parent 2573fcd commit 0f3df5e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pytwitter/rate_limit.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ def get_limit(self, auth_type, method="GET"):
179179
LIMIT_APP_GET=300,
180180
LIMIT_USER_GET=900,
181181
)
182+
USERS_SEARCH = Endpoint(
183+
resource="/users/search",
184+
regex=re.compile(r"/users/search"),
185+
LIMIT_USER_GET=900,
186+
)
182187
USER_FOLLOWING = Endpoint(
183188
resource="/users/:id/following",
184189
regex=re.compile(r"/users/\d+/following"),
@@ -371,6 +376,12 @@ def get_limit(self, auth_type, method="GET"):
371376
LIMIT_APP_GET=50,
372377
)
373378

379+
TRENDS = Endpoint(
380+
resource="/trends/by/woeid/:woeid",
381+
regex=re.compile(r"/trends/by/woeid/\d+"),
382+
LIMIT_APP_GET=75,
383+
)
384+
374385
MEDIA_UPLOAD = Endpoint(
375386
resource="/media/upload.json",
376387
regex=re.compile(r"/media/upload.json"),
@@ -399,6 +410,7 @@ def get_limit(self, auth_type, method="GET"):
399410
USERS_BY_ID,
400411
USER_BY_USERNAME,
401412
USERS_BY_USERNAME,
413+
USERS_SEARCH,
402414
USER_FOLLOWING,
403415
USER_REMOVE_FOLLOWING,
404416
USER_FOLLOWER,
@@ -433,6 +445,7 @@ def get_limit(self, auth_type, method="GET"):
433445
DM_MESSAGE_TO_CONVERSATION,
434446
DM_CONVERSATIONS,
435447
USAGE_TWEETS,
448+
TRENDS,
436449
MEDIA_UPLOAD,
437450
]
438451

0 commit comments

Comments
 (0)