Python/requests

From Omnia
Revision as of 01:37, 14 May 2024 by Kenneth (talk | contribs) (Created page with "== requests == import requests requests.post(url='https://foo.example', data={'bar':'baz'}) == Ignore SSL == requests.get('https://bad-ssl.com', verify=False) Turn off all warning messages: import requests requests.urllib3.disable_warnings() As of Python 3.6+ can turn off the specific warning message too: import warnings warnings.filterwarnings("ignore", message="Unverified HTTPS request") ref: https://stackoverflow.com/questions/15445981/how-do-i-disable-th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

requests

import requests
requests.post(url='https://foo.example', data={'bar':'baz'})

Ignore SSL

requests.get('https://bad-ssl.com', verify=False)

Turn off all warning messages:

import requests
requests.urllib3.disable_warnings()

As of Python 3.6+ can turn off the specific warning message too:

import warnings
warnings.filterwarnings("ignore", message="Unverified HTTPS request")

ref: https://stackoverflow.com/questions/15445981/how-do-i-disable-the-security-certificate-check-in-python-requests