Python-yipit-wrapper is a project mainly written in PYTHON and JAVASCRIPT, based on the Apache-2.0 license.
A Python wrapper for the Yipit API
Making this very rudimentary for basic use. I tried to keep this very well commented so look through the code.
Docs now available here: Epydoc-generated (my fav): /doc/index.html Sphinx-generated : /docs/index.html
** Look at test.py for more examples of how to use this wrapper Try this to test: >> python test.py your_api_key
[INSTALL] $ python setup.py install
[BASIC EXAMPLE]
import yipit
api = yipit.Api(api_key = "mykeyasdfasdfasdfasdfasd9fa9sfa9s")
''' DEALS API ''' deals = api.get_deals(lat=-100.2, lon=144.444, radius=20, divison=["new-york"], source=["groupon","living-social"], phone=[2123335555], tag=['restaurants','bar-club'], paid=True, limit=5000) # all are optional params
individ_deal = api.get_deal_by_id(deal_id = 16721)
for deal in deals: print deal._title print deal._url print deal._yipit_title print deal._yipit_url print deal._active print deal._business # dictionary with the business information print deal._date_added print deal._division # dictionary with division information print deal._end_date print deal._id print deal._images # dictionary with 'image_big' and 'image_small' print deal._mobile_url print deal._discount # dictionary with 'formatted' and 'raw' print deal._price # dictionary with 'formatted' and 'raw' print deal._value # dictionary with 'formatted' and 'raw' print deal._purchased print deal._source # will be a dictionary of the source print deal._tags # will be a list of tag dictionaries
''' SOURCES API ''' sources = api.get_sources(division=['new-york','atlanta'], paid=False, limit=10)
for source in sources: print source._name print source._slug print source._paid print source._url
''' DIVISIONS API ''' api.get_divisions(source=['groupon', 'living-social'] lat=40.7654629, lon=-73.97724, radius=25, limit=10)
for division in divisions: print division._slug print division._name print division._active print division._time_zone_diff # based off UTC print division._lat print division._lon print division._url
''' TAGS API ''' tags = api.get_tags() # there are no filters
for tag in tags: print tag._name print tag._slug print tag._url
''' BUSINESSES API '''
businesses = api.get_businesses(lat=40.7654629, lon=-73.97724, radius=25, phone=222111333, division=['new-york'])
for business in businesses: print business._id print business._name print business._url print business._locations location = business._locations[0] # a list of location dictionaries print location['id'] print location['address'] print location['locality'] print location['phone'] print location['lat'] print location['lon']
TODO Make stdin work for test.py goal (this should work eventually): >> python test.py the_api_key
BUGS
RESOLVED: Yipit server goes down periodically, added error catching
Traceback (most recent call last):
File "