if fetched_companies:
print("Saving it all!")
with open(FOURSQUARE_DATASET_PATH, "w") as outfile:
json.dump(fetched_companies, outfile)
else:
print("Nothing to save.")
After Change
print("%s requests made. Stopping to save." % index)
if fetched_companies:
write_fetched_companies(fetched_companies)
fetched_companies = []
else:
print("Nothing to save.")
print("//////////////////////////////////////////////////////////////////////////////////////")
print("")