Problems retrieving XML with Python requests



I am probably overseeing something obvious but I can't seem to figure it. I am trying a simple verification to start with using the following url.


http://ift.tt/1tBOYmR


http://ift.tt/1tBOXiO


(Here's the full documentation regarding this URL).


This is the code used for testing it out.



class Foobar():
def __init__(self):
pass

def bar(self):
client = requests.get('http://ift.tt/1tBOYmR',
auth=(username, password))

if client.status_code == 200:
print "Succesfull authentication. %i"%client.status_code
else:
print "Authentication failed %i"%client.status_code

print client.text

Foo = Foobar()
Foo.bar()


I got a correct response once and assumed this was the right way of going. However from this part on I only receive responses like this.


Every request send regarding the user credentials being correct or not.


I've tried various encoding and neither have affected the response in any way.


No comments:

Post a Comment