Skip to content

Commit

Permalink
upgrade to tweepy 4.5
Browse files Browse the repository at this point in the history
had a backward incompatible change from 4.4, sadly. they kept OAuthHandler as a convenience alias when they renamed it to OAuth1UserHandler, but they moved the constructor's callback arg to keyword and broke positional. :/
  • Loading branch information
snarfed committed Jan 30, 2022
1 parent ed974d5 commit 0c5cd60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions oauth_dropins/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def __init__(self, to_path, scopes=None, access_type=None):
def redirect_url(self, state=None):
assert twitter_auth.TWITTER_APP_KEY and twitter_auth.TWITTER_APP_SECRET, \
"Please fill in the twitter_app_key and twitter_app_secret files in your app's root directory."
auth = tweepy.OAuthHandler(twitter_auth.TWITTER_APP_KEY,
twitter_auth.TWITTER_APP_SECRET,
self.to_url(state=state))
auth = tweepy.OAuth1UserHandler(twitter_auth.TWITTER_APP_KEY,
twitter_auth.TWITTER_APP_SECRET,
callback=self.to_url(state=state))

# signin_with_twitter=True returns /authenticate instead of /authorize so
# that Twitter doesn't prompt the user for approval if they've already
Expand Down Expand Up @@ -150,8 +150,8 @@ def dispatch_request(self):
flask_util.error(f'Invalid oauth_token: {oauth_token}')

# Rebuild the auth view
auth = tweepy.OAuthHandler(twitter_auth.TWITTER_APP_KEY,
twitter_auth.TWITTER_APP_SECRET)
auth = tweepy.OAuth1UserHandler(twitter_auth.TWITTER_APP_KEY,
twitter_auth.TWITTER_APP_SECRET)
auth.request_token = {'oauth_token': request_token.key.string_id(),
'oauth_token_secret': request_token.token_secret}

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'python-tumblpy~=1.1',
'requests-oauthlib',
'requests~=2.22',
'tweepy<=4.4',
'tweepy~=4.5',
'ujson>=5.1',
'urllib3~=1.14',
'webapp2>=3.0.0b1',
Expand Down

0 comments on commit 0c5cd60

Please sign in to comment.