Problem with certificate CA in python (SSL: CERTIFICATE_VERIFY_FAILED) #761
-
I'm trying to control my camera through python, but i'm getting the same error over and over. It says 'HTTPSConnectionPool (host=192.168.1.15, port=443): Max retries exceeded with url: /axis-cgi/basicdeviceinfo.cgi (Caused by SSLError(SSLCertVerificationErrro(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (ssl.c:1000)'))) I'm not very experienced in python so might be missing something. Here's my code: import requests ip_address = '192.168.1.15' url = f'http://{ip_address}/axis-cgi/basicdeviceinfo.cgi' parameters = { response = requests.get(url, json=parameters) print(response.status_code) In the line 'response = requests.get(url, json=parameters)' is where the error occurs. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This automatically generated reply acts as a friendly reminder. Answers to your questions will most often come from the community, from developers like yourself. You will, from time to time, find that Axis employees answers some of the questions, but this is not a guarantee. Think of the discussion forum as a complement to other support channels, not a replacement to any of them. If your question remains unanswered for a period of time, please revisit it to see whether it can be improved by following the guidelines listed in Axis support guidelines. |
Beta Was this translation helpful? Give feedback.
-
Hi @roomsjesse , If you are using a self-signed certificate on the Axis device then try with "verify=False": import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) #
import requests
from requests.auth import HTTPDigestAuth
#Camera credentials
cam_user = 'Vivek'
cam_pass = 'Kumar' # Replace with your actual password
auth = HTTPDigestAuth(cam_user, cam_pass)
ip_address = '10.176.12.130'
url = f'https://{ip_address}/axis-cgi/basicdeviceinfo.cgi'
parameters = {
'apiVersion': '1.0',
'context': 'Client defined request ID',
'method': 'getAllProperties',
}
response = requests.post(url, json=parameters, auth=auth,verify=False)
print(response.status_code)
try:
print(response.json())
except ValueError:
print(response.text) Output:Settings: |
Beta Was this translation helpful? Give feedback.
Hi @roomsjesse ,
Take a look at this : 402
If you are using a self-signed certificate on the Axis device then try with "verify=False":