Skip to main content

Python API to interact with Airtable

Project description

AirtablePy

build status

Python API to interact with Airtable

Table of Contents

  1. Installation
  2. API Token
  3. Simple Interface
  4. License

Installation

AirtablPy is available on pypi. Install using pip.

pip install AirtablePy

API Token

To use the Airtable API, you need a valid token. You may setup an environment variable called AIRTABLE_API_KEY which this interface will use.

Simple Interface

from AirtablePy import AirtableAPI
from AirtablePy.utils import retrieve_keys
from AirtablePy.query import date_query

# Instantiate interface with valid token.
# If token is not specified, it will search for environment variable AIRTABLE_API_KEY
api = AirtableAPI(token="keyXXXXXXXXXXXXXX")

# Construct a valid url
base_id = "appXXXXXXXXXXXXXX"
table_name = "Example Table"
url = api.construct_url(base_id, table_name)

# Retrieve records from a table, with or without a query filter
records = api.get(url, query=date_query(column_name="date", start="20220401", end="20220415"))

# Upload new data entries
data = {"Column 1": [1, 2, 3], "Column 2": [4, 5, 6]}
response_upload = api.push(url=url, data=data)

# Collect a list of record id's from upload
record_ids = retrieve_keys(response_upload, "id")

# Update records with additional (or modified) data
data_update = {"Column 3": [7, 8, 9]}  # data will be present in all three columns
response_update = api.update(url=url, data=data_update, record_id=record_ids)

# Replace existing records with different data
data_replace = {"Column 2": [10, 11, 12]}  # only column 2 will have data
response_replace = api.replace(url=url, data=data_replace, record_id=record_ids)

# Delete existing Records
response_delete = api.delete(url=url, record_id=record_ids)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AirtablePy-0.1.3.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

AirtablePy-0.1.3-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file AirtablePy-0.1.3.tar.gz.

File metadata

  • Download URL: AirtablePy-0.1.3.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for AirtablePy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 00ae4891a16356284cd5d1380d0923dc91bf1f310a61c39fa83b2f55a59547da
MD5 5503cfcec142681f2fa54e663c4af3bc
BLAKE2b-256 40189cc52e5c4d7456f6959618a03808da7ab9b18c703f7289f59a6d614d7f69

See more details on using hashes here.

File details

Details for the file AirtablePy-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: AirtablePy-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for AirtablePy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b2d6a4e4ab2cc7fe7f93292b158ffd6e2dfc02643b8d849b4ce38861d2bc3380
MD5 c1bae01a2a3ced1f5b0c952dbba0def6
BLAKE2b-256 51d5040e7e019ee93ec5fc640573b9d31ed9582dd0b869b438afe10b40ced60a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page