Reputation: 5
Iam new to python & API searches. I am having issues reading yelp API responses in python. any help would be great. thanks.
> params = {
> 'term': 'lunch,pancakes' }
> response=client.search('Los Angeles',**params)
Here is the output:
<yelp.obj.search_response.SearchResponse object at 0x138ad7a58>
Upvotes: 0
Views: 383
Reputation: 1316
You may need to do a JSON conversion to make it subscriptable .
import json
json_response = json.loads(response)
for business in json_response['businesses']:
print(business['name'])
Upvotes: 1
Reputation: 841
SearchResponse
contains the businesses
list that will match your term [1].
Try this:
for business in response['businesses']:
print(business['name'])
[1] https://www.yelp.com/developers/documentation/v2/search_api
Upvotes: 0