Getting Started¶
Installation¶
$ pip install pyairtable
Warning
Looking for airtable-python-wrapper? Check out 0.x Migration.
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.