endpoints

Endpoints classes for Airtable API.

An endpoint is reference to a table or a record.

Creating a Table Endpoint

>>> BASE = 'app0123456789abcd'
>>> contacts = TableEndpoint(
...     base=BASE,
...     table='Contacts'
...     )
>>> contacts
... 
TableEndpoint(base='app0123456789abcd',
    table='Contacts')
>>> contacts.url
'https://api.airtable.com/v0/app0123456789abcd/Contacts'

Creating a Record Endpoint

>>> john = RecordEndpoint(
...     base=BASE,
...     table='Contacts',
...     record='rec0123456789abcd'
...     )
>>> john
... 
RecordEndpoint(base='app0123456789abcd',
    table='Contacts',
    record='rec0123456789abcd')
>>> john.url
'https://api.airtable.com/v0/app0123456789abcd/Contacts/rec0123456789abcd'

Sugar

Getting URLs through Endpoint.__str__()

You can also get an endpoint’s URL by getting its str representation:

>>> print john
https://api.airtable.com/v0/app0123456789abcd/Contacts/rec0123456789abcd

Dynamic Endpoint Creation

Instead of instantiating endpoints directly, you can use make_endpoint to get an endpoint whose type is based on the arguments you provide. Combine it with the star notation and endpoint creation becomes very dynamic:

>>> a = (BASE, 'Cakes')
>>> b = (BASE, 'Cakes', 'rec0123456789abcd')
>>> make_endpoint(*a)
TableEndpoint(base='app0123456789abcd', table='Cakes')
>>> make_endpoint(*b)
RecordEndpoint(base='app0123456789abcd', table='Cakes', record='rec0123456789abcd')
class firetable.endpoints.Endpoint[source]

Bases: object

get()[source]
url
class firetable.endpoints.RecordEndpoint[source]

Bases: firetable.endpoints.Endpoint, firetable.endpoints.RecordEndpoint

get()[source]
class firetable.endpoints.TableEndpoint[source]

Bases: firetable.endpoints.Endpoint, firetable.endpoints.TableEndpoint

get(**kwargs)[source]
firetable.endpoints.make_endpoint(base, table, record=None)[source]
firetable.endpoints.testmod()[source]