I’m trying to include a list of synonyms for words that a user inputs in my program. I want to send the word to the Big Huge Thesaurus API which returns the data. I’m using the requests module to send the term but the API is only returning the HTTP response code. What I am expecting is a json object that I can extract the synonyms from. Can someone help me with this please?
>>import requests
>>term = 'Big'
>>Thesaurus=requests.get("http://words.bighugelabs.com/api/2/mykey/%s/json" % term, auth=('',''))
>>print Thesaurus
<Response [200]>
Pretty sure you have to use
Thesaurus.content,Thesaurus.text, orThesaurus.json.requests.get()returns arequests.Responseobject, and when you print that, it’s just doing an implicit string cast, which for this type of object, just returns the response code formatted in the string you are seeing printed here.