yelp-fusion icon indicating copy to clipboard operation
yelp-fusion copied to clipboard

Batching requests or delaying requests to pull all lat/long from a CSV then call API?

Open mo-naqvi47 opened this issue 5 years ago • 0 comments

Overview

  • Client ID: yZUZE2dxOOlWl0M6eMUyTA
  • Issue type: question
  • Summary: Is there a way for me to use a list of latitudes and longitudes to call the API? Maybe a batch request? Or perhaps entering multiple latitude and longitudes?
  • Platform: Desktop/web

Description

(I am trying to get review count and 3 reviews for a list of businesses. I cant figure out how to call the API with more than 1 lat/long or business name)

More information

(Fill this section out if applicable (for things like bugs or questions))

Endpoint

(Fusion Search API - business search)

Parameters or Sample Request

import requests import json import csv

with open('....csv') as csvCoordinates: coordinates = csvCoordinates.readlines() print (coordinates) #n_lines = len(coordinates) #for line_num in list(range(n_lines)): #api_key="..." #headers = {'Authorization': 'Bearer %s' % api_key} #url='https://api.yelp.com/v3/businesses/search' #params = '%s' % coordinates[line_num].rstrip("\n") #print (params) #req=requests.get(url, params=params, headers=headers) #print('The status code is {}'.format(req.status_code)) #json.loads(req.text)

Response

Extra information

mo-naqvi47 avatar Jul 17 '20 21:07 mo-naqvi47