Skip to content

Instantly share code, notes, and snippets.

@horvatha
Created March 7, 2018 10:08
Show Gist options
  • Save horvatha/b9c960aa064e0569aa4c03ce1c86e621 to your computer and use it in GitHub Desktop.
Save horvatha/b9c960aa064e0569aa4c03ce1c86e621 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# coding: utf-8
"""Find something near a given coordinate.
client_id and client_secret needs a registration on FourSquare
pip install requests
"""
# from urllib import requests
import json, requests
from client_id_secret import client_id, client_secret
url = 'https://api.foursquare.com/v2/venues/explore'
def get_something_somewhere(what, where):
params = dict(
client_id=client_id,
client_secret=client_secret,
v='20170801',
ll=where,
query=what,
limit=1
)
resp = requests.get(url=url, params=params)
data = json.loads(resp.text)
return data
lls = [
# ("pizza", "37.392971, -122.076044"),
# ("sushi", "25.773822, -80.237947"),
# ("donuts", "38.897478, -77.000147"),
# ("salad", "40.768349, -73.96575"),
("pizza", "47.7424894,18.8936815"), # Rám szakadék
]
for what, where in lls:
print(get_something_somewhere(what, where))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment