Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Asynchronous RESTful API consumer for Python

Project Description

Finch: RESTful API consumer

Finch is an asynchronous RESTful API consumer for Python. Finch is focused on remove all of the boilerplate related to consuming http based APIs and provide a high level abstraction to develop API clients. Finch is released under the Apache 2 license, so you can fork, contribute and also report errors and suggestions to improve it.


To start consuming a REST API you first should define the resources you are going to consume. For resources modeling we use the booby data modeling library. So, for example, to get your repos from you should define the Repo model and the Repos collection.

from booby import Model, fields
from finch import Collection

class Repo(Model):
    id = fields.Integer()
    name = fields.String()
    owner = fields.String()
    is_private = fields.Boolean()

    def parse(self, body, headers):
        return parse_repo(json.loads(body))

    def __repr__(self):
        return 'Repo({}/{})'.format(self.owner,

class Repos(Collection):
    model = Repo

    def __init__(self, username, *args, **kwargs):
        self.username = username

        super(Repos, self).__init__(*args, **kwargs)

    def url(self):
        return '{}/repos'.format(self.username)

    def parse(self, body, headers):
        return [parse_repo(r) for r in json.loads(body)]

def parse_repo(raw):
    return {
        'id': raw['id'],
        'name': raw['name'],
        'owner': raw['owner']['login'],
        'is_private': raw['private']

Now you can fetch your public repos (and also your private repos if you’re authenticated).

from tornado import httpclient, ioloop

def on_repos(repos, error):

    if error:
        raise error

    for repo in repos:
        print repo

repos = Repos('jaimegildesagredo', httpclient.AsyncHTTPClient())



You can install the last stable release of Finch from PyPI using pip or easy_install.

$ pip install finch

Also you can install the latest sources from Github.

$ pip install -e git+git://


To run the Finch tests suite you should install the development requirements and run nosetests.

$ pip install -r requirements-devel.txt
$ nosetests tests/unit


Finch is under active development and there is not a complete documentation yet. By the moment you can read the examples in this repository and read the tests, that are the most up to date documentation. Also I’m working on create a complete API client using Finch and create a good documentation.

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
finch-0.3.3.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Sep 27, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting