-
Notifications
You must be signed in to change notification settings - Fork 0
/
foursquareManager.py
34 lines (27 loc) · 1.05 KB
/
foursquareManager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from foursquare_secrets import SECRETS
import urllib
import json
import logging
API_VERSION = u'20130613'
<<<<<<< HEAD
def getVenusNearby(latitude, longitude):
uri = 'https://api.foursquare.com/v2/venues/search?ll=%s,%s&client_id=%s&client_secret=%s&v=%s'
url = uri % (latitude, longitude, SECRETS['client_id'], SECRETS['client_secret'], API_VERSION )
return fetchJson(url)
=======
def getVenusNearby(ll, limit=None):
limit = 30
uri = 'https://api.foursquare.com/v2/venues/search?ll=%s&client_id=%s&client_secret=%s&v=%s&limit=%s'
url = uri % (ll, SECRETS['client_id'], SECRETS['client_secret'], API_VERSION, limit)
return fetchJson(url)
>>>>>>> 6bcdb0a832b65e306c6968b0f77b9d6aa31adbde
def fetchJson(url):
"""Does a GET to the specified URL and returns a dict representing its reply."""
<<<<<<< HEAD
logging.info('fetching url: ' + url)
=======
logging.info('fetching url: ' + url)
>>>>>>> 6bcdb0a832b65e306c6968b0f77b9d6aa31adbde
result = urllib.urlopen(url).read()
#logging.info('got back: ' + result)
return json.loads(result)