Created
March 7, 2019 21:21
-
-
Save KHwong12/141e341e733062c89f2864a938543cea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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