diff --git a/tango.py b/tango.py index 5313cfa..0994257 100644 --- a/tango.py +++ b/tango.py @@ -40,7 +40,13 @@ class setup: self.auth_manager.add_password(None, "http://twitter.com", self.username, self.password) self.handler = urllib2.HTTPBasicAuthHandler(self.auth_manager) self.opener = urllib2.build_opener(self.handler) - self.authenticated = True + try: + test_verify = simplejson.load(self.opener.open("http://twitter.com/account/verify_credentials.json")) + self.authenticated = True + except HTTPError, e: + if self.debug is True: + print e.headers + print "Huh, authentication failed with your provided credentials. Try again? (" + str(e.code) + " failure)" # OAuth functions; shortcuts for verifying the credentials. def fetch_response_oauth(self, oauth_request): diff --git a/tango3k.py b/tango3k.py index c707aae..ba3d771 100644 --- a/tango3k.py +++ b/tango3k.py @@ -42,7 +42,13 @@ class setup: self.auth_manager.add_password(None, "http://twitter.com", self.username, self.password) self.handler = urllib.request.HTTPBasicAuthHandler(self.auth_manager) self.opener = urllib.request.build_opener(self.handler) - self.authenticated = True + try: + test_verify = simplejson.load(self.opener.open("http://twitter.com/account/verify_credentials.json")) + self.authenticated = True + except HTTPError as e: + if self.debug is True: + print(e.headers) + print("Huh, authentication failed with your provided credentials. Try again? (" + str(e.code) + " failure)") # OAuth functions; shortcuts for verifying the credentials. def fetch_response_oauth(self, oauth_request):