Skip to content

Commit

Permalink
feat(users): ✨ add ratelimit for search users and trends
Browse files Browse the repository at this point in the history
  • Loading branch information
MerleLiuKun committed Mar 18, 2024
1 parent 2573fcd commit 0f3df5e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pytwitter/rate_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ def get_limit(self, auth_type, method="GET"):
LIMIT_APP_GET=300,
LIMIT_USER_GET=900,
)
USERS_SEARCH = Endpoint(
resource="/users/search",
regex=re.compile(r"/users/search"),
LIMIT_USER_GET=900,
)
USER_FOLLOWING = Endpoint(
resource="/users/:id/following",
regex=re.compile(r"/users/\d+/following"),
Expand Down Expand Up @@ -371,6 +376,12 @@ def get_limit(self, auth_type, method="GET"):
LIMIT_APP_GET=50,
)

TRENDS = Endpoint(
resource="/trends/by/woeid/:woeid",
regex=re.compile(r"/trends/by/woeid/\d+"),
LIMIT_APP_GET=75,
)

MEDIA_UPLOAD = Endpoint(
resource="/media/upload.json",
regex=re.compile(r"/media/upload.json"),
Expand Down Expand Up @@ -399,6 +410,7 @@ def get_limit(self, auth_type, method="GET"):
USERS_BY_ID,
USER_BY_USERNAME,
USERS_BY_USERNAME,
USERS_SEARCH,
USER_FOLLOWING,
USER_REMOVE_FOLLOWING,
USER_FOLLOWER,
Expand Down Expand Up @@ -433,6 +445,7 @@ def get_limit(self, auth_type, method="GET"):
DM_MESSAGE_TO_CONVERSATION,
DM_CONVERSATIONS,
USAGE_TWEETS,
TRENDS,
MEDIA_UPLOAD,
]

Expand Down

0 comments on commit 0f3df5e

Please sign in to comment.