Skip to content

Instantly share code, notes, and snippets.

@ampvchen
Created Mar 15, 2022
Embed
What would you like to do?
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