Move chains to their own directory

This commit is contained in:
Chandler Swift 2023-07-25 18:13:39 -05:00
parent f3f7a21645
commit c74edcb8c0
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
21 changed files with 50 additions and 40 deletions

View file

@ -0,0 +1,37 @@
#!/usr/bin/env python3
import requests
import re
import json
res = requests.get('https://api.krispykreme.com/shops/?latitude=44.7601&longitude=-93.2748&count=1000&shopFeatureFlags=0&includeGroceryStores=false&includeShops=true')
locations = json.loads(res.text)
stores = []
for location in locations:
stores.append({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [float(location['longitude']), float(location['latitude'])], # yes, [lon, lat] since it's [x, y]
},
"properties": {
'address': location['address1'].title(),
'city': location['city'].title(),
'state': location['state'],
'zip': location['zipCode'],
'website': location['pagesUrl'],
},
})
geojson = {
"type": "FeatureCollection",
"features": stores,
}
with open("krispy-kreme-data.geojson", "w") as f:
f.write(json.dumps(geojson))
print(f"{len(locations)} locations found")