diff options
author | clarkzjw <[email protected]> | 2023-02-20 01:55:20 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-20 01:55:20 -0800 |
commit | 3a230798be1bc63b363cf75b8b1cae3a508cca84 (patch) | |
tree | 6df81aa7028c130726cdf0bcc3abb4f6f106fdf3 /foursquare/query_poi.py | |
parent | 48cd0ed8abf0e84fc5d013a126e84c65ef0ed87a (diff) | |
download | swarm2fediverse-3a230798be1bc63b363cf75b8b1cae3a508cca84.tar.gz |
4sq: add query poi example
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] | ||