Fixed credential verification with Basic (HTTP) Auth; previously, it assumed that passing in credentials meant you knew what you were doing. I take full blame for that act of idiocracy, but it's fixed now.
This commit is contained in:
parent
b82f88c101
commit
76ca83cb87
2 changed files with 14 additions and 2 deletions
8
tango.py
8
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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue