[Python] How to request more than 20 results from Yelp API?

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to get a complete list of restaurants in Toronto from Yelp. Here is my Python code:

    import urllib2
    import rauth

    params="term=restaurants&location=Toronto&limit=20&cc=CA"
    consumer_key = "***"
    consumer_secret = "***"
    token = "***"
    token_secret = "***"
    session = rauth.OAuth1Session(
    consumer_key = consumer_key
    ,consumer_secret = consumer_secret
    ,access_token = token
    ,access_token_secret = token_secret)

    request = session.get("http://api.yelp.com/v2/search",params=params)


    data = request.json()


    The problem is that Yelp can only return 20 results. Is there a way to retrieve more than 20 results?

    Continue reading...

Compartilhe esta Página