Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
111 views
in Technique[技术] by (71.8m points)

python 3.x - Python3 - Get Request with Secret

I am trying to send a get request to Airtable to get metadata but I keep getting errors.

I have tried the below.

base_schema_url = 'https://api.airtable.com/v0/meta/bases/BaseId(replaced this)/tables'
secret_meta_token = '123'

#attempt 1
r = requests.get(base_schema_url, headers={'Authorization': secret_meta_token})
print(r.text)

#attempt 2
r = requests.get(base_schema_url,
      headers={'Content-Type':'application/json',
               'Authorization': 'Bearer {}'.format(secret_meta_token)})
print(r.text)

#attempt 3
header = {'PRIVATE-TOKEN': secret_meta_token}
r = requests.get(base_schema_url, headers=header)
print(r.text)

I have a feeling it's because I need to pass in the user API + the Meta token but I'm not too sure how to do it.

question from:https://stackoverflow.com/questions/66056598/python3-get-request-with-secret

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The metadata API uses a separate key that you need to send a formal request to the Airtable team by registering at the link provided at the top of the page.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...