api.integrations.airtable¶
Airtable, through pyAirtable (https://pyairtable.readthedocs.io).
The main base’s records as dictionaries:
from api.integrations import airtable
from api.integrations.airtable import schema
units = airtable.list_records(schema.ToutesLesUnites.TABLE, "{Statut commercial} = 'A vendre'")
or as typed objects, through the generated ORM classes of schema:
schema.ToutesLesUnites.all(formula=...)
pyAirtable retries a request refused for the rate limit (429) and never resends one that failed
otherwise, so a creation cannot be duplicated. Other bases (the auctions base) use api().
Submodules¶
Attributes¶
Functions¶
|
A pyAirtable client: the main base's token by default. |
|
A table of the main base. |
|
|
|
Every record of the table, optionally filtered by an Airtable formula. |
|
These records, in this order; ids that no longer exist are left out. |
|
|
|
|
|
|
|
updates is [{"id": ..., "fields": {...}}, ...]. |
|
|
|
Adds a file (5 MB max) to an attachment field; Airtable keeps its own copy. |
|
The main base's tables and fields, as Airtable describes them (cached). |
|
The options of a single or multiple select field, in Airtable's order. |
|
Record id of each name in the table (read once; see clear_caches). |
|
|
|
Forget the cached structure and names (after a change in Airtable). |
Package Contents¶
- api.integrations.airtable.Record¶
- api.integrations.airtable.api(token: str | None = None) pyairtable.Api¶
A pyAirtable client: the main base’s token by default.
- api.integrations.airtable.table(name: str) pyairtable.Table¶
A table of the main base.
- api.integrations.airtable.list_records(table_name: str, formula: str | None = None, *, fields: list[str] | None = None, view: str | None = None) list[Record]¶
Every record of the table, optionally filtered by an Airtable formula.
- api.integrations.airtable.get_records(table_name: str, record_ids: list[str]) list[Record]¶
These records, in this order; ids that no longer exist are left out.
- api.integrations.airtable.create_records(table_name: str, fields_list: list[dict[str, Any]]) list[Record]¶
- api.integrations.airtable.update_record(table_name: str, record_id: str, fields: dict[str, Any]) Record¶
- api.integrations.airtable.update_records(table_name: str, updates: list[Record]) list[Record]¶
updates is [{“id”: …, “fields”: {…}}, …].
- api.integrations.airtable.delete_record(table_name: str, record_id: str) None¶
- api.integrations.airtable.upload_attachment(table_name: str, record_id: str, field: str, content: bytes, filename: str, content_type: str = 'application/pdf') Record¶
Adds a file (5 MB max) to an attachment field; Airtable keeps its own copy.
- api.integrations.airtable.base_schema() list[dict[str, Any]]¶
The main base’s tables and fields, as Airtable describes them (cached).
- api.integrations.airtable.select_choices(table_name: str, field: str) list[str]¶
The options of a single or multiple select field, in Airtable’s order.
- api.integrations.airtable.ids_by_name(table_name: str, name_field: str = 'Name') dict[str, str]¶
Record id of each name in the table (read once; see clear_caches).
- api.integrations.airtable.names_by_id(table_name: str, name_field: str = 'Name') dict[str, str]¶
- api.integrations.airtable.clear_caches() None¶
Forget the cached structure and names (after a change in Airtable).