The `airtable` library, maintained by josephbestjames on PyPI (version 0.4.8), is a Python client for interacting with the Airtable REST API. It provides a straightforward interface for performing CRUD (Create, Read, Update, Delete) operations on Airtable bases and tables, abstracting the underlying HTTP requests. This library has a relatively slow release cadence, with its latest update in early 2021. Developers seeking a more actively maintained and feature-rich client should consider `pyairtable`.
pip install airtableVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Airtable client and fetch all records from a specified table. It also includes an example of creating a new record. Authentication should use an Airtable Personal Access Token (PAT) loaded from an environment variable for security, as legacy API keys are deprecated.
Determine which library you intend to use. If you need current features and active development, install `pyairtable` (`pip install pyairtable`). If you specifically need this `airtable` library, ensure your code adheres to its API, which may differ significantly from `pyairtable`.
Generate a Personal Access Token from your Airtable Developer Hub. Configure it with the necessary scopes for your base and tables, and use this token in place of your old API key.
Rename your script to something other than `airtable.py` (e.g., `my_airtable_script.py`).
Implement exponential backoff and retry logic in your application to handle 429 responses gracefully. If using `pyairtable`, it includes built-in retry mechanisms.
Refer to the method signatures in the `airtable` library's GitHub README or source code. Use `at.get(table_name, record_id=None, ...)` for fetching and `at.create(table_name, fields)` for creating records.
Ensure the module is imported correctly using 'from airtable import Airtable' and verify that no local files are named 'airtable.py'.
Install the module using 'pip install airtable' and ensure the correct Python environment is active.
Verify the installation of the 'airtable' module and ensure it is up to date by running 'pip install --upgrade airtable'.
Verify your Airtable API key or Personal Access Token (PAT) is correct and has the appropriate read/write permissions for the base and table you are accessing. Ensure the Base ID and table name are accurate. For `airtable-python-wrapper`, try setting your API key as an environment variable: `os.environ['AIRTABLE_API_KEY'] = 'your_api_key_here'` before initializing the `Airtable` object, or pass it as a parameter: `Airtable(base_id, table_name, api_key='your_api_key')`. Also, confirm that you are using a Personal Access Token (PAT) if your API key starts with 'pat', as older 'key' prefixed API keys have been deprecated by Airtable.
Review the Airtable API documentation for the specific table and field types to ensure your request payload is correctly structured. Data for record creation/update should typically be wrapped in a 'fields' dictionary, like `{'fields': {'FieldName': 'Value'}}`. Check that field names match exactly (case-sensitive) and that data types are compatible with the Airtable field types. Ensure you are not trying to update computed fields or fields where the provided value is invalid for a linked record.