Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gearplug/airtable-python
airtable-python is an API wrapper for Airtable, written in Python
https://github.com/gearplug/airtable-python
airtable api database notifications oauth2 python records tables webhooks wrapper
Last synced: 7 days ago
JSON representation
airtable-python is an API wrapper for Airtable, written in Python
- Host: GitHub
- URL: https://github.com/gearplug/airtable-python
- Owner: GearPlug
- License: mit
- Created: 2023-01-02T19:44:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-28T15:36:30.000Z (almost 2 years ago)
- Last Synced: 2024-12-22T18:04:45.498Z (25 days ago)
- Topics: airtable, api, database, notifications, oauth2, python, records, tables, webhooks, wrapper
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![](https://img.shields.io/badge/version-0.1.0-success) ![](https://img.shields.io/badge/code-Python-4B8BBE?logo=python&logoColor=white)
# 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)
```
2. Get access token using code
```
token = client.token_creation(code)
```
3. 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)
```