A Python wrapper for the Yelp API v2

Overview

python-yelp-v2

A Python wrapper for the Yelp API v2. The structure for this was inspired by the python-twitter library, and some internal methods are reused.

Installation

From pypi

pip install python-yelp-v2

Usage

You must have yelp oauth credentials: http://www.yelp.com/developers/getting_started

import yelp

yelp_api = yelp.Api(consumer_key=MY_CONSUMER_KEY,
                    consumer_secret=MY_CONSUMER_SECRET,
                    access_token_key=MY_ACCESS_TOKEN,
                    access_token_secret=MY_ACCESS_SECRET)

Searching

search_results = yelp_api.Search(term="my search term", location="my location") # location and search term are required
for business in search_results.businesses:
    print business.name

See the exact attributes available on the search result set

Getting business info

business = yelp_api.GetBusiness('post-no-bills-brooklyn')
print business.name

The business class lists all of the attributes that are available for each business the API returns.

Todo

  • Create classes for categories.
  • Improve the location class

Authors

License

Copyright Matthew Conlen

MIT

Comments
  • python-yelp-v2 is not a valid module name

    python-yelp-v2 is not a valid module name

    I tried to follow your example. Not working.

    import yelp

    does not work, since the pip install python-yelp-v2 will install the pip package as a module. Yet the "python-yelp-v2" is not a valid module name, so I cannot do:

    import python-yelp-v2.yelp # which is what I need

    opened by peterlada 6
  • ImportError No module named filecache

    ImportError No module named filecache

    1. new dir, new venv, activate
    2. pip install python-yelp-v2
    3. new sample.py:
        import yelp
    
        yelp_api = yelp.Api(consumer_key='...',
                            consumer_secret='...',
                            access_token_key='...',
                            access_token_secret='...')
    
        search_results = yelp_api.Search(term='malea', location="New York", limit=1)
        for business in search_results.businesses:
            print business.__dict__
    
    1. python sample.py
    Traceback (most recent call last):
      File "sample.py", line 1, in <module>
        import yelp
      File "/Users/air/repo/yelp/venv/lib/python2.7/site-packages/yelp.py", line 22, in <module>
        from yelp.filecache import FileCache
    ImportError: No module named filecache
    

    OSX 10.9.4 python 2.7.5 (not homebrew) virtualenv 1.10.1 pip freeze:

    httplib2==0.9
    oauth2==1.5.211
    python-yelp-v2==0.4.0
    wsgiref==0.1.2
    
    opened by peterlada 3
  • Fixes #14 Handle unicode parameter to GetBusiness().

    Fixes #14 Handle unicode parameter to GetBusiness().

    I made sure that it doesn't re-quote the business id if someone's existing code does it before calling GetBusiness(). vim also removed some trailing white space automatically so the diff is a little bigger than necessary.

    opened by egrubbs 2
  • Deal Class

    Deal Class

    Hey, I think I am doing this right. This is my first pull request. At any rate, I added a deal class, following the format of the other classes and looking at the attributes from the Yelp API. One attribute, Options, is a list of other attributes. Right now I am just returning the list of Options, rather than Options attributes. I don't know how to drill deeper into a list, so I figured if it returns a list (and it's a Python list) it should be pretty easy to grab any data you want out of it. If I should do it a different way though, let me know.

    opened by triplec1988 2
  • GetBusiness does not handle unicode business ids

    GetBusiness does not handle unicode business ids

    The Search function returned this business id:

    u'red-cat-jazz-caf\xe9-houston-3'
    

    GetCachedTime() cannot handle unicode objects, and urllib requires non-ascii characters in a utf-8 string to be escaped. Therefore, to get GetBusiness() to work, I had to call it like this:

    business = yelp_api.GetBusiness(urllib.quote(business.id.encode('utf-8')))
    

    I have to use GetBusiness() since Search() does not include the review.

    opened by egrubbs 1
  • add tests

    add tests

    example from https://github.com/mathisonian/python-yelp-v2/issues/10 could be a could starting point

        import yelp
    
        yelp_api = yelp.Api(consumer_key='...',
                            consumer_secret='...',
                            access_token_key='...',
                            access_token_secret='...')
    
        search_results = yelp_api.Search(term='malea', location="New York", limit=1)
        for business in search_results.businesses:
            print business.__dict__
    
    enhancement 
    opened by mathisonian 1
  • Add support for searching yelp

    Add support for searching yelp

    Introduces Api.Search method and SearchResultSet class. Fixes a bug related to instantiating businesses without reviews, along with a syntax error caused by indentation.

    opened by relwell 1
  • No results found

    No results found

    I have tried searching for the keyword "clown" and "photographer" using the yelp fusion api however, it does not return any results.

    opened by alyssavillacete 0
  • Search api is not returning results

    Search api is not returning results

    Hi there-

    I am new to API and wanted to try to use the yelp.Api for a class I am taking. However, the search_results example you provided in your readme file does not appear to be working:

    search_results = yelp_api.Search(term="my search term") for business in search_results.businesses: print business.name

    do you have any ideas? Thanks!

    opened by rickjunli 6
Owner
Matthew Conlen
Ph.D. student @uwdata, graphics editor at the New York Times.
Matthew Conlen
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 3k Dec 29, 2022
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 3k Dec 29, 2022
Python API wrapper around Trello's API

A wrapper around the Trello API written in Python. Each Trello object is represented by a corresponding Python object. The attributes of these objects

Richard Kolkovich 904 Jan 2, 2023
Async ready API wrapper for Revolt API written in Python.

Mutiny Async ready API wrapper for Revolt API written in Python. Installation Python 3.9 or higher is required To install the library, you can just ru

null 16 Mar 29, 2022
A Python API wrapper for the Twitter API!

PyTweet PyTweet is an api wrapper made for twitter using twitter's api version 2! Installation Windows py3 -m pip install PyTweet Linux python -m pip

TheFarGG 1 Nov 19, 2022
Python API wrapper library for Convex Value API

convex-value-python Python API wrapper library for Convex Value API. Further Links: Convex Value homepage @ConvexValue on Twitter JB on Twitter Authen

Aaron DeVera 2 May 11, 2022
This an API wrapper library for the OpenSea API written in Python 3.

OpenSea NFT API Python 3 wrapper This an API wrapper library for the OpenSea API written in Python 3. The library provides a simplified interface to f

Attila Tóth 159 Dec 26, 2022
YARSAW is an Async Python API Wrapper for the Random Stuff API.

Yet Another Random Stuff API Wrapper - YARSAW YARSAW is an Async Python API Wrapper for the Random Stuff API. This module makes it simpler for you to

Bruce 6 Mar 27, 2022
EpikCord.py - This is an API Wrapper for Discord's API for Python

EpikCord.py - This is an API Wrapper for Discord's API for Python! We've decided not to fork discord.py and start completely from scratch for a new, better structuring system!

EpikHost 28 Oct 10, 2022
A simple Python API wrapper for Cloudflare Stream's API.

python-cloudflare-stream A basic Python API wrapper for working with Cloudflare Stream. Arbington.com started off using Cloudflare Stream. We used the

Arbington 3 Sep 8, 2022
Discord-Wrapper - Discord Websocket Wrapper in python

This does not currently work and is in development Discord Websocket Wrapper in

null 3 Oct 25, 2022
An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% api coverage most of the codebase is documented

null 7 Dec 11, 2022
An API Wrapper for Gofile API

Gofile2 from gofile2 import Gofile g_a = Gofile() print(g_a.upload(file="/home/itz-fork/photo.png")) An API Wrapper for Gofile API. About API Gofile

I'm Not A Bot #Left_TG 16 Dec 10, 2022
A simple API wrapper for the Tenor API

Gifpy A simple API wrapper for the Tenor API Installation Python 3.9 or higher is recommended python3 -m pip install gifpy Clone repository: $ git cl

Juan Ignacio Battiston 4 Dec 22, 2021
An API wrapper around Discord API.

NeoCord This project is work in progress not for production use. An asynchronous API wrapper around Discord API written in Python. Features Modern API

Izhar Ahmad 14 Jan 3, 2022
A wrapper for The Movie Database API v3 and v4 that only uses the read access token (not api key).

fulltmdb A wrapper for The Movie Database API v3 and v4 that only uses the read access token (not api key). Installation Use the package manager pip t

Jacob Hale 2 Sep 26, 2021
An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% API coverage Most of the codebase is documented

null 7 Dec 11, 2022
An API wrapper for Henrik's Unofficial VALORANT API

ValorantAPI.py An API wrapper for Henrik's Unofficial VALORANT API Warning!! This project is still in beta and only contains barely anything yet. If y

Jakkaphat Chalermphanaphan 0 Feb 4, 2022