Professional Documents
Culture Documents
Third Presentation
Third Presentation
CURL to perform an API "GET". I have browsed through some questions on here but I am still a bit
confused on how to do this; from what I have seen, I can use the "requests" library like this:
URL = requests.get("www.example.com/123")
However, the Curl command I normally run uses authentication as well. Here is an example:
Can I still use the requests library when creating a script to pull this data? Specifically, I would need to be
able to pass along the authentication info along with the URL itself.
Update:
import requests
import json
url = ("api.example.com/v1.11/user?id=123456")
print(response.json)
However, I am getting a response [401] error. I think I am probably doing something wrong with my
headers, can anyone help?
pythonpython-2.7
Share
Follow
edited Dec 28, 2020 at 12:49
jeppoo1
user7681184
Add a comment
1 Answer
Sorted by: