Skip to content

Commit 0c5cd60

Browse files
committed
upgrade to tweepy 4.5
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. :/
1 parent ed974d5 commit 0c5cd60

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

oauth_dropins/twitter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def __init__(self, to_path, scopes=None, access_type=None):
106106
def redirect_url(self, state=None):
107107
assert twitter_auth.TWITTER_APP_KEY and twitter_auth.TWITTER_APP_SECRET, \
108108
"Please fill in the twitter_app_key and twitter_app_secret files in your app's root directory."
109-
auth = tweepy.OAuthHandler(twitter_auth.TWITTER_APP_KEY,
110-
twitter_auth.TWITTER_APP_SECRET,
111-
self.to_url(state=state))
109+
auth = tweepy.OAuth1UserHandler(twitter_auth.TWITTER_APP_KEY,
110+
twitter_auth.TWITTER_APP_SECRET,
111+
callback=self.to_url(state=state))
112112

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

152152
# Rebuild the auth view
153-
auth = tweepy.OAuthHandler(twitter_auth.TWITTER_APP_KEY,
154-
twitter_auth.TWITTER_APP_SECRET)
153+
auth = tweepy.OAuth1UserHandler(twitter_auth.TWITTER_APP_KEY,
154+
twitter_auth.TWITTER_APP_SECRET)
155155
auth.request_token = {'oauth_token': request_token.key.string_id(),
156156
'oauth_token_secret': request_token.token_secret}
157157

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
'python-tumblpy~=1.1',
5454
'requests-oauthlib',
5555
'requests~=2.22',
56-
'tweepy<=4.4',
56+
'tweepy~=4.5',
5757
'ujson>=5.1',
5858
'urllib3~=1.14',
5959
'webapp2>=3.0.0b1',

0 commit comments

Comments
 (0)