From 3a230798be1bc63b363cf75b8b1cae3a508cca84 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Mon, 20 Feb 2023 01:55:20 -0800 Subject: 4sq: add query poi example --- foursquare/query_poi.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 foursquare/query_poi.py (limited to 'foursquare') 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 @@ +import requests +import json +from config import FSQ_API_KEY + +POI_API_ENDPOINT = "https://api.foursquare.com/v3/places/nearby?ll={}%2C{}" + + +def query_poi(latitude, longitude): + url = POI_API_ENDPOINT.format(latitude, longitude) + + headers = { + "accept": "application/json", + "Authorization": FSQ_API_KEY + } + + response = requests.get(url, headers=headers) + print(response.text) + return json.loads(response.text)["results"][:2] -- cgit v1.2.3