Skip to content

Commit bcc1f2e

Browse files
committed
Fix error when using old .oauth.json file without access token
1 parent 67ad60f commit bcc1f2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/parser.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def parse_tweet(tweet, include_retweets, image_size, results):
8989
def get_medias(auth, user_id, include_retweets, image_size, since, since_id, until, until_id, likes):
9090
"""Get all medias for a given Twitter user."""
9191
tweepy_auth = tweepy.OAuthHandler(auth['consumer_key'], auth['consumer_secret'])
92-
tweepy_auth.set_access_token(auth['access_token'], auth['access_token_secret'])
92+
if 'access_token' in auth and 'access_token_secret' in auth:
93+
tweepy_auth.set_access_token(auth['access_token'], auth['access_token_secret'])
9394

9495
api = tweepy.API(tweepy_auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
9596

0 commit comments

Comments
 (0)