Getting Started

Installation

$ pip install pyairtable

Warning

Looking for airtable-python-wrapper? Check out 0.x Migration.


Authorization Token

Airtable accepts two types of authentication tokens: Api Keys, and Personal Access tokens. Your auth token should be securely stored. A common way to do this, is to store it as an environment variable, and load it using os.environ:

import os
api_key = os.environ["AIRTABLE_API_KEY"]

Quickstart

The easiest way to use this client is to use the Table class to fetch or update your records:

>>> import os
>>> from pyairtable import Table
>>> api_key = os.environ['AIRTABLE_API_KEY']
>>> table = Table(api_key, 'base_id', 'table_name')
>>> table.all()
[
    {
        "id": "rec5eR7IzKSAOBHCz",
        "createdTime": "2017-03-14T22:04:31.000Z",
        "fields": {...}
    }
]
>>> table.create({"Foo": "Bar"})
{
    "id": "recwAcQdqwe21asdf",
    "createdTime": "...",
    "fields": {"Foo": "Bar"}
}
>>> table.update("recwAcQdqwe21asdf", {"Foo": "Foo"})
{
    "id": "recwAcQdqwe21asdf",
    "createdTime": "...",
    "fields": {"Foo": "Foo"}
}
>>> table.delete("recwAcQdqwe21asdf")
{'id': 'recwAcQdqwe21asdf', 'deleted': True}

For more details on the available classes and methods check out the Airtable Api section.