diff options
Diffstat (limited to 'foursquare/query_poi.py')
-rw-r--r-- | foursquare/query_poi.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/foursquare/query_poi.py b/foursquare/query_poi.py new file mode 100644 index 0000000..64ded55 --- /dev/null +++ b/foursquare/query_poi.py | |||
@@ -0,0 +1,18 @@ | |||
1 | import requests | ||
2 | import json | ||
3 | from config import FSQ_API_KEY | ||
4 | |||
5 | POI_API_ENDPOINT = "https://api.foursquare.com/v3/places/nearby?ll={}%2C{}" | ||
6 | |||
7 | |||
8 | def query_poi(latitude, longitude): | ||
9 | url = POI_API_ENDPOINT.format(latitude, longitude) | ||
10 | |||
11 | headers = { | ||
12 | "accept": "application/json", | ||
13 | "Authorization": FSQ_API_KEY | ||
14 | } | ||
15 | |||
16 | response = requests.get(url, headers=headers) | ||
17 | print(response.text) | ||
18 | return json.loads(response.text)["results"][:2] | ||