0

I want to convert this curl command to python code:

Curl -X GET -H "Authorization: Bearer $token" "http://blablabla.com"

I converted to this:

requests.get("http://blablabla.com", data={'Authorization' : 'Bearer ' + token}).json()

But i have error "Access denied"

1 Answer 1

2

You have to pass the Authorization token inside the headers:

requests.get("http://blablabla.com", headers={'Authorization' : 'Bearer ' + token}).json()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.