Skip to content

Commit 9126027

Browse files
committed
feat(ratelimit): ✨ add ratelimt setting for dm events
1 parent 534f2b8 commit 9126027

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

pytwitter/rate_limit.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,37 @@ def get_limit(self, auth_type, method="GET"):
326326
LIMIT_APP_GET=150,
327327
LIMIT_APP_POST=150,
328328
)
329+
DM_EVENTS_BY_PARTICIPANT = Endpoint(
330+
resource="/dm_conversations/with/:participant_id/dm_events",
331+
regex=re.compile(r"/dm_conversations/with/\d+/dm_events"),
332+
LIMIT_APP_GET=300,
333+
)
334+
DM_EVENTS_BY_CONVERSATION = Endpoint(
335+
resource="/dm_conversations/:dm_conversation_id/dm_events",
336+
regex=re.compile(r"/dm_conversations/\d+/dm_events"),
337+
LIMIT_APP_GET=300,
338+
)
339+
DM_EVENTS = Endpoint(
340+
resource="/dm_events",
341+
regex=re.compile(r"/dm_events"),
342+
LIMIT_APP_GET=300,
343+
)
344+
345+
DM_MESSAGE_TO_PARTICIPANT = Endpoint(
346+
resource="/dm_conversations/with/:participant_id/messages",
347+
regex=re.compile(r"/dm_conversations/with/\d+/messages"),
348+
LIMIT_APP_GET=200,
349+
)
350+
DM_MESSAGE_TO_CONVERSATION = Endpoint(
351+
resource="/dm_conversations/:dm_conversation_id/messages",
352+
regex=re.compile(r"/dm_conversations/\d+/messages"),
353+
LIMIT_APP_GET=200,
354+
)
355+
DM_CONVERSATIONS = Endpoint(
356+
resource="/dm_conversations",
357+
regex=re.compile(r"/dm_conversations"),
358+
LIMIT_APP_GET=200,
359+
)
329360

330361
PATH_VAR_ENDPOINTS = [
331362
TWEET_BY_ID,
@@ -376,6 +407,12 @@ def get_limit(self, auth_type, method="GET"):
376407
USER_PINNED_LISTS_BY_ID,
377408
COMPLIANCE_JOB_BY_ID,
378409
COMPLIANCE_JOBS,
410+
DM_EVENTS_BY_PARTICIPANT,
411+
DM_EVENTS_BY_CONVERSATION,
412+
DM_EVENTS,
413+
DM_MESSAGE_TO_PARTICIPANT,
414+
DM_MESSAGE_TO_CONVERSATION,
415+
DM_CONVERSATIONS,
379416
]
380417

381418

0 commit comments

Comments
 (0)