If you are using the below curl command using username/password and you want to convert the same into Python code, the following code snippet will help you
curl --user user:pass "https://api.company.com/dummyapi.json"
You need to install requests module
pip install requests
Then send an http request is as easy as :
from requests import get response = get('https://api.company.com/dummyapi.json', auth=('user', 'pass'))
Now response holds all information returned from that api
response
Comment here