import requests
from requests.auth import HTTPBasicAuth
username = ""
password = ""
response = requests.get(url, headers=headers, auth=HTTPBasicAuth(username, passwrd))
Getting Below Error while calling the above API:
SSLError: HTTPSConnectionPool(host='', port=): Max retries exceeded with url: '' (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1002)')))
requests==2.32.3
requests-mock==1.12.1
urllib3==1.26.18
urllib3-secure-extra==0.1.0
pyOpenSSL==23.1.0
certifi==2024.12.14
idna==3.7
cryptography==40.0.2
2
I am thinking that your API is protected with JWTs and you are trying BasicAuth with username and password to access it, while what you need is a token. Basic Auth is for protected resources that require a sign-in while trying to visit the page.
Like this (from requests docs): https://httpbin.org/basic-auth/user/pass
What you would want to do is sent a request to your authentication endpoint with the username and password and get a token, and use that in your request.
EDIT:
If you are testing locally with HTTP or HTTPS (with self-signed certificate) you might also want to use verify=False
as a parameter.