Yelp API responding with only 50 results

635 views Asked by At

When i run the program it gave me upto 50 records/results so i create an 'offset' which will give me more than 50 then i run the code again and the result appear are same, only get 50 records not more than that.

import requests
import json
import pandas as pd

api_key = 'jdfhdf......'
headers = {'Authorization': 'Bearer %s' % api_key}
search_api_url = 'https://api.yelp.com/v3/businesses/search'
parameters = {
        'term': 'Food',
        'location': 'Atlanta',
        'limit': '50',
        'offset': 1000
    }
req = requests.get(search_api_url, headers=headers, params=parameters)
parsed = json.loads(req.text)
businesses = parsed["businesses"]
cols= list(businesses[0].keys())
data = pd.DataFrame(columns=cols)
for biz in businesses:
    data = data.append(biz, ignore_index=True)
    print(data)
    data.to_csv('sample.csv')
0

There are 0 answers