Skip to content

Commit

Permalink
API limit避けにsleep入れた
Browse files Browse the repository at this point in the history
  • Loading branch information
masuidrive committed Mar 5, 2023
1 parent 40ddecd commit edb15c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ def load_messages(channel_id):
else:
print("Error : {}".format(e))
return None
# conversations_history api limit is 20 per minute
time.sleep(3)

# messages = result["messages"]
messages = list(filter(lambda m: "subtype" not in m, result["messages"]))

if len(messages) < 1:
Expand All @@ -106,6 +107,7 @@ def load_messages(channel_id):
messages_text = []

while result["has_more"]:
time.sleep(3) # this api limit is 20 per minute
result = client.conversations_history(
channel=channel_id,
oldest=start_time.timestamp(),
Expand Down

0 comments on commit edb15c1

Please sign in to comment.