[新手问题]
我正在尝试使用 python 3 在我的 Airtable 库中创建一条新记录。文档中的 curl 命令如下:
$ curl -v -XPOST https://api.airtable.com/v0/restoftheurl \
-H "Authorization: Bearer My_API_Key" \
-H "Content-type: application/json" \
-d '{
"fields": {
"Item": "Headphone",
"Quantity": "1",
"Customer_ID": [
"My_API_Key"
]
}
}'
我尝试使用的python代码是:
import requests
API_URL = "https://api.airtable.com/v0/restoftheurl"
data = {"Authorization": "Bearer My_API_Key","Content-type":
"application/json","fields": {"Item": "randomitem","Quantity":
"5","Customer_ID": ["randomrecord"]}}
r = requests.post(API_URL, data)
print(r.json())
响应是错误的地方:
{'error': {'type': 'AUTHENTICATION_REQUIRED', 'message': 'Authentication required'}}
我应该如何正确验证这一点,或者我是这样的?