Skip to content
Advertisement

How do I provide my access_token with python

request = requests.get(f"https://api.mercadopago.com/v1/payments/{id}")

https://i.stack.imgur.com/Iqrsw.png

Is there a way to do this with requests?

Advertisement

Answer

According to this https://www.mercadopago.com.ar/developers/en/reference/payments/_payments_id/get you need to provide a header with your access token you get through OAUTH. And then once you get the access token, you can do

header = {"Authorization": "Bearer " + "your access token"}
result = requests.get(f"https://api.mercadopago.com/v1/payments/{id}", headers=header)

which will return you a json result

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement