Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
Fixed trying to tweet before uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisMayo committed Jan 31, 2021
1 parent a3532c9 commit 2aefdfa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def check_mentions():
anim.comments_to_scene(thread, characters, output_filename=output_filename)
try:
uploaded_media = api.media_upload(output_filename, media_category='TWEET_VIDEO')
while (uploaded_media.processing_info['state'] == 'pending'):
time.sleep(uploaded_media.processing_info['check_after_secs'])
uploaded_media = api.get_media_upload_status(uploaded_media.media_id_string)
api.update_status('@' + tweet.author.screen_name + ' ', in_reply_to_status_id=tweet.id_str, media_ids=[uploaded_media.media_id_string])
except tweepy.error.TweepError as e:
try:
Expand Down Expand Up @@ -77,4 +80,4 @@ def check_mentions():

s = sched.scheduler(time.time, time.sleep)
s.enter(0, 2, check_mentions)
s.run()
s.run()

0 comments on commit 2aefdfa

Please sign in to comment.