Search code examples
pythonyelp

Use Yelp API to search for restaurants by category using Python script


I would like to search Yelp API for restaurants by category. However, the keyword I use gets me an invalid error. Here's what I mean:

Using Python code (search.py) from: https://github.com/Yelp/yelp-api/tree/master/v2/python

I have the following query:

python search.py --consumer_key=XXX --consumer_secret=XXXX \
--token=XXX --token_secret=XXX --location="sf" --term="restaurants" --category='Indian'

I get the following error:

{
  "error": {
    "field": "category_filter", 
    "id": "INVALID_PARAMETER", 
    "text": "One or more parameters are invalid in request"
  }
}

Could you show me the correct query for category to make this work? Please note that when I remove the --category keyword, the query works.


Solution

  • Use the category identifier "indpak"

    see: http://www.yelp.com/developers/documentation/category_list http://www.yelp.com/developers/documentation/v2/search_api#searchGP