Consume APIs and hold them to account.

schematics, xml, model, modelling, dicttoxml, xmltodict
pip install eater==0.4.0



Consume APIs and hold them to account.

Build Status Code Health Code Coverage Documentation Status Latest Version Supported Python versions

Not every API provider has an API as nice as Stripe and often their documentation is incorrect or (arguably better) non-existent.

Not every API provider can manage their release cycle, like inform customers, conform to semantic version numbers etc..

Chances are, if you're reading this, you're trying to talk to an API just like this.

You want to be sure, when you send them something, they give you the right thing back. That is, it contains the write shape of data and the correct data types and if you're really persnickety, that it validates against defined rules.

Well, this Python library, with the help of schematics, will allow you to do just that.


pip install eater


Not that this has ever happened to anyone, ever... but let's say you are dealing with an API that you don't necessarily trust. Perhaps the API is in flux because it's alpha/beta or perhaps it's not versioned and changes get made without notifying users. In any case, you want to be sure that what it says it does, it definitely does.

Using eater, first you define the API to be consumed, in part using schematics models.

import eater
from schematics import Model, IntegerType, StringType, BooleanType, ListType, ModelType

class Book(Model):
    title = StringType(required=True, min_length=3)

class Request(Model):
    Represents, as a Python object, the JSON data required by the API.
    in_print = BooleanType()

class Response(Model):
    Represents, as a Python object, the JSON response returned by the API.
    books = ListType(ModelType(Book))

class BooksAPI(eater.HTTPEater):
    url = ''
    request_cls = Request
    response_cls = Response

You can then consume the API;

api = BooksAPI()
response = api(in_print=True)

for book in response.books:

See the full documentation at


Alex Hayes <>