-
-
Save ampvchen/1645597c2076c01eae1bc33dffee8810 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
import os | |
import requests | |
import json | |
headers = { | |
'Content-Type': 'application/json', | |
'apikey': os.environ.get('SGAPI') | |
} | |
query = """ | |
query radius { | |
search( | |
filter: { | |
by_radius: { | |
latitude: 37.78247 | |
longitude: -122.407752 | |
distanceInMeters: 100 | |
} | |
} | |
) { | |
places { | |
results(first: 10) { | |
edges { | |
node { | |
placekey | |
safegraph_core { | |
location_name | |
street_address | |
city | |
region | |
iso_country_code | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
""" | |
req = requests.post( | |
'https://api.safegraph.com/v2/graphql', | |
json={ | |
'query': query | |
}, | |
headers=headers | |
) | |
print(req.json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment