Q:

HTTP request with requests in python returning text instead of json

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 

A:

There is nothing wrong with the code.
I have inspected your API request upstream by going to the source: the  API provider's page and it looks like the API is defunct/not working as expected.
Which is exactly why you're getting errors.
Solution:
1) Contact the provider to try to resolve the problem, its on them not on you to fix it
2) Find an alternative API from the same portal: https://www.mashape.com/explore?query=gender
Good luck

