Skip to content

mjaskula/brewerydb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

BreweryDB API Python Wrapper

This is a simple wrapper around the BreweryDB API packaged as a Python module.

Remember: Good People Drink Good Beer!

Version

  • 1.1 Reimplemented wrapper using reflection and updated README.
  • 1.0 Initial release

Todo

By Priority

  • Add automated testing
Other
  • Find elegant way to support post requests

Dependencies

Notes

This wrapper uses reflection to instantiate its methods at runtime. This was done to avoid huge amounts of code duplication. However, it also has the added benefit of allowing you to extend it without modifying it. Simply call one of:

__make_simple_endpoint_fun(name)
__make_singlearg_endpoint_fun(name)

This will generate a new function called name that creates a new request to: BreweryDb base url + "/" + name.

Usage

from brewerydb import *
BreweryDb.configure(apikey[, baseuri])

It is important that configure is called before calling any of the other methods. Methods are created at runtime during configure.

If you see an error: AttributeError: class BreweryDb has no attribute X

You most likely did not call BreweryDb.configure.

Code Examples

Fetching all beers:

BreweryDb.beers()

Getting a list of beers on a specific page:

BreweryDb.beers({'page':10})

Searching for beers with a specific query:

BreweryDb.search({'type':'beer','q':'unibroue'})

Getting a specific beer or brewery by ID:

BreweryDb.beer(O3tmVI)

Getting all the breweries around Seattle, WA:

BreweryDb.breweries({'geo':1,
                 'lat':47.6097,
    		 'lng':-122.3331,
                     'radius':30,
                     'units':'m'})

About

Python wrapper for the BreweryDb.com API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 87.1%
  • JavaScript 12.9%