Skip to content

Instantly share code, notes, and snippets.

@Seanny123
Created July 15, 2020 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seanny123/0e49f61d60c3969d87409c0fd7b0402d to your computer and use it in GitHub Desktop.
Save Seanny123/0e49f61d60c3969d87409c0fd7b0402d to your computer and use it in GitHub Desktop.
Example of using Yelp rest API
import json
import requests
yelp_auth = "nope"
def get_events( city ):
headers = { "Authorization": f"Bearer {yelp_auth}" }
params = {"location": city, "limit": 5, "term": "seafood"}
req = requests.get(
'https://api.yelp.com/v3/businesses/search',
headers=headers,
params=params,
)
return json.loads(req.text)
print(get_events("New York"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment