Created
February 9, 2016 20:39
-
-
Save MariuszWisniewski/122e97ca8656fee20fc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import time | |
| client_id = "" | |
| client_secret = "" | |
| limit = 10 | |
| default_what = "sushi" | |
| what = ARGS["POST"].get("what","") | |
| if not what: | |
| what = ARGS["GET"].get("what","") | |
| if not what: | |
| what = default_what | |
| link = "https://api.foursquare.com/v2/venues/search\ | |
| ?client_id={CLIENT_ID}\ | |
| &client_secret={CLIENT_SECRET}\ | |
| &v=20160209\ | |
| &ll=40.7,-74\ | |
| &query={what}\ | |
| &limit={limit}".format(CLIENT_ID=client_id, CLIENT_SECRET=client_secret, what=what, limit=limit) | |
| start = time.time() | |
| r = requests.get(link) | |
| end = time.time() | |
| print "Foursquare API Call [ms]: {duration}".format(duration=(end - start)*1000) | |
| print r.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment