Skip to content

Instantly share code, notes, and snippets.

@ampvchen
Created March 15, 2022 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ampvchen/1645597c2076c01eae1bc33dffee8810 to your computer and use it in GitHub Desktop.
Save ampvchen/1645597c2076c01eae1bc33dffee8810 to your computer and use it in GitHub Desktop.
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