Contagem até 20
jorgelcff opened this issue · comments
Jorge Freitas commented
Jorge Freitas commented
Pessoal, o next_page_token tem uma dificuldade que facilmente podemos resolver, estamos fazendo requisição e querendo respostas instantâneas. Colocando um time.sleep(5)
(devemos fazer a importação da blibioteca time como as outras import time
)após identificarmos a nova página, tudo se resolve.
if 'next_page_token' not in jj:
labels = ['Place Name','ID_Field', 'Latitude', 'Longitude', 'Rating', 'Tags']
location_df = pd.DataFrame.from_records(final_data, columns=labels)
#location_df.to_csv('location.csv')
break
else:
next_page_token = jj['next_page_token']
search_url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?key='+str(api_key)+'&pagetoken='+str(next_page_token)
time.sleep(5)