Airtable Python Wrapper

0.15.3 · active · verified Thu Apr 16

airtable-python-wrapper is a Python API client wrapper for the Airtable API, enabling programmatic interaction with Airtable bases and tables. The latest version is 0.15.3, released in July 2021. While functional, this library has effectively been superseded by 'pyairtable' for its 1.x+ releases, and no new releases are expected under the `airtable-python-wrapper` name.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the Airtable client with your Base ID, Table Name, and API Key, then perform basic CRUD (Create, Read, Update, Delete) operations. Ensure API key is stored securely.

import os
from airtable import Airtable

# It's recommended to store sensitive information like API keys in environment variables
AIRTABLE_API_KEY = os.environ.get('AIRTABLE_API_KEY', 'YOUR_API_KEY')
AIRTABLE_BASE_ID = os.environ.get('AIRTABLE_BASE_ID', 'YOUR_BASE_ID')
AIRTABLE_TABLE_NAME = os.environ.get('AIRTABLE_TABLE_NAME', 'YOUR_TABLE_NAME')

# Initialize Airtable client
airtable = Airtable(AIRTABLE_BASE_ID, AIRTABLE_TABLE_NAME, api_key=AIRTABLE_API_KEY)

# Fetch all records from the table
records = airtable.get_all()
print(f"Fetched {len(records)} records.")
# print(records[0]) # Uncomment to see an example record

# Insert a new record
new_record_data = {'Name': 'New Task', 'Status': 'To Do'}
inserted_record = airtable.insert(new_record_data)
print(f"Inserted new record with ID: {inserted_record['id']}")

# Update a record (using its ID)
# Note: You'll need a valid record ID for this to work.
# Example: record_to_update_id = inserted_record['id']
# updated_data = {'Status': 'Done'}
# updated_record = airtable.update(record_to_update_id, updated_data)
# print(f"Updated record with ID: {updated_record['id']}")

# Search for records by field value
found_records = airtable.search('Name', 'New Task')
print(f"Found {len(found_records)} records matching 'New Task'.")

view raw JSON →