Skip to main content

airtable-python

airtable-python is an API wrapper for Airtable, written in Python

  • Use this library if you are interested in Oauth authentication and webhook notifications.

Installing

pip install airtable-python

Usage

from airtable.client import Client
client = Client(client_id, client_secret, redirect_uri, code_verifier)

Note: If you already have an access token, you can initiate Client without any parameters and directly set token with the access token you have as a dictionary client.set_token({"access_token": token})

Get access_token

To get the access token using Oauth2 follow the next steps. Check https://airtable.com/developers/web/api/oauth-reference for more info:

  1. Get authorization URL to receive code
url = client.authorization_url(state)
  1. Get access token using code
token = client.token_creation(code)
  1. Set access token
client.set_token(access_token)

If your access token expired, you can get a new one using refresh_token:

response = client.refresh_access_token(refresh_token)

And then set access token again...

Get current user

user = client.get_current_user()

List Bases

bases = client.list_bases()

List Tables

tables = client.list_base_tables(baseId)

List records

records = client.list_records(
    baseId, 
    tableId, 
    pageSize=None, 
    maxRecords=None, 
    filter_field=None, 
    filter_value=None, 
    sort_field=None, 
    sort_direction=None
)
# baseId and tableId are required
# sort_direction options are 'desc' or 'asc'

Create Records

records = [
    {
        "fields": {
          "Projects": "Project from python",
          "Status": "In progress",
          "Complete?": False
        }
    },
]
records = client.create_records(baseId, tableId, records)

Update Record

data = {
    "Status": "Complete",
    "Complete?": True
}
record = client.update_record(baseId, tableId, recordId, data)

Update Multiple Records

records = [
    {
        "id": "recB4UscNECOHnT7y",
        "fields": {
            "Number": 10000,
        },
    },
    {
        "id": "recFkktx671jlvyj8",
        "fields": {
            "Number": 20000,
        },
    },
]
updated_records = client.update_record(baseId, tableId, records)

List Collaborators (needs enterprise scopes access)

collabs = client.list_collaborators(baseId)

Metadata

Release files for airtable-python 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airtable-python 0.1.1
File Size Uploaded
airtable_python-0.1.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for airtable-python 0.1.1
File Interpreter ABI Platform
airtable_python-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / airtable_python-0.1.1.tar.gz

Download URL airtable_python-0.1.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5dc6e5be6c2422bc187831e89635bd686c666258f72f2b69515a4df29f873ef7
BLAKE2b-256 checksum
How to use checksums
61ac909f9da9b21bc1d179183de254c4c188cada687156a0e33d66c5fde0dba2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / airtable_python-0.1.1-py3-none-any.whl

Download URL airtable_python-0.1.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9da8a08575b8f91f22de33699159ca68e297ee5392a2eb4e65f1ceb2c4f9805a
BLAKE2b-256 checksum
How to use checksums
0abd68399f71ce61fb35db8dda6a17796686b0e0c13a326edddd88391b280a4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page