Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def main():
"""
Get the details of the shop by brute-force searching the id of the shop
"""
# Approximate minimum and maximum storeid are searched manually
storeid_min = 2050
storeid_max = 2600
outFile = 'nakau_rawdata.csv'
# Keys from the get_data function
headers = ['storeid','brand','name','lat','lon','postalCode','address',
'business_hour1','business_hour2','business_hour3']
with open(outFile, 'w', newline='') as csvfile:
writer = csv.DictWriter(csvfile, delimiter=',', lineterminator='\n',fieldnames=headers)
# Write the headers
writer.writeheader()
for storeid in range(storeid_min,storeid_max+1):
print(f"Processing {storeid}...")
store_row = get_data_sukiya(storeid)
if store_row == None:
print(f"failed to request the page with storeid {storeid}")
continue
writer.writerow(store_row)
csvfile.close()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment