Reputation: 95
iam using Python 3.6 on my Linux machine. And my HTTPS requests does not work.
import requests
requests.get('https://192.168.56.101:4665/v1/objects/services/docker-icinga2!random-005', verify=False, auth=('root', 'icinga'))
The response is:
/usr/local/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
With the disable_warnings so that code:
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# Disable flag warning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
requests.get('https://192.168.56.101:4665/v1/objects/services/docker-
icinga2!random-005', auth=('root', 'icinga'))
I get this as response (u see in the picture) Error
Upvotes: 1
Views: 3435
Reputation: 283
To disable this warning, you can use requests.package.disable_warnings
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# Disable flag warning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
requests.get('https://192.168.56.101:4665/v1/objects/services/docker-icinga2!random-005', verify=False, auth=('root', 'icinga'))
Upvotes: 3