def thready(name,count):
payload={'Accept': 'application/json;charset=utf-8', 'X-Mashape-Key': 'key'
}
link = "https://montanaflynn-gender-guesser.p.mashape.com/?name=" + name
r=requests.get(link ,headers=payload)
print r.headers
data=r.json()
print data
count=0
thready("bob",count)
So I just tried to do a simple HTTP request in python. In the r.header i get
{'date': 'Wed, 22 Jul 2015 06:30:12 GMT', 'content-length': '178', 'content-type
': 'text/html', 'connection': 'keep-alive', 'server': 'Mashape/5.0.6'}
In the header I said it should return json. The return is text though? Very confused about this fact? Some insight would be very helpful because I'm trying to do the simple
print data['message']print r.textand paste it here?