log warning about Twitter API bug: signin_with_twitter and access_type don't play...
authorRyan Barrett <git@ryanb.org>
Wed, 13 Aug 2014 00:30:03 +0000 (17:30 -0700)
committerRyan Barrett <git@ryanb.org>
Wed, 13 Aug 2014 00:30:03 +0000 (17:30 -0700)
sigh. background: https://dev.twitter.com/discussions/21281

@Aaron1011, i'm open to doing something stronger about this if you want, e.g. don't allow them both at the same time, or silently disable signin_with_twitter if access_type is set (which isn't as nice).

tweepy/auth.py

index e18b71e37f8554511997b6ce5b3ca3cf674002dc..4ed5900a6dd77bdb2accdd2c6706c3b6b1fabdd1 100644 (file)
@@ -2,6 +2,7 @@ from urllib2 import Request, urlopen
 import urllib
 import base64
 import json
+import logging
 
 from tweepy.error import TweepError
 from tweepy.api import API
@@ -65,6 +66,11 @@ class OAuthHandler(AuthHandler):
         try:
             if signin_with_twitter:
                 url = self._get_oauth_url('authenticate')
+                if access_type:
+                    logging.warning(
+                        "Warning! Due to a Twitter API bug, signin_with_twitter "
+                        "and access_type don't always play nice together. Details: "
+                        "https://dev.twitter.com/discussions/21281")
             else:
                 url = self._get_oauth_url('authorize')
             self.request_token = self._get_request_token(access_type=access_type)