单向同步python dicts到airtable。
atsync的Python项目详细描述
自述文件
此工具提供来自python dicts的单向等幂同步。使用airtable python包装器访问airtable rest api。
安装
pip install atsync
文档
目前仅此自述文件
使用示例
这个库小而简单,只做一件事:将dicts插入airtable。
# Define each related table in a list of dictsrelated_tables=[{'table_name':'Contact Details','primary_key':'Email Address',# primary key of this related table'related_on':'Email',# key in our target table that is related to this table},]# Define your target table with an atsync Table instancesync_table=atsync.Table(table_name='User Table',primary_key='User ID',# primary key as seen in the airtable user interface'base_key':'appZZZZZZZZZZZZZZ',# Can be found in the url of your api doco (see below)*'api_key':'keyABCDEFG',# Can be found in the api doco (see below)*related_tables=related_tables)# Assumes all the fields in users.csv are also in airtablewithopen('users.csv','r')asuser_file:importcsvusers=csv.DictReader(user_file)foruserinusers:sync_table.update_record(user)# updates existing reocrd with same primary key, otherwise inserts a new record
*要查找base_key
和api_key
,请打开airtable,单击右上角的“帮助”链接,选择“api文档”。
- 您的
base_key
将是url的第一个部分,位于域之后:airtable.com/>;这个位<;/api/docs\ - 您的
api_key
可以通过单击页面右上角的“show api key”复选框找到