Created
February 2, 2024 09:43
-
-
Save mh0w/2f7a4985f9523a783588a0ad075bd842 to your computer and use it in GitHub Desktop.
Supress specific warning messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import warnings | |
# Suppress warnings containing the text "Unverified HTTPS request" | |
with warnings.catch_warnings(): | |
warnings.filterwarnings("ignore", message="Unverified HTTPS request") | |
list_of_available_datasets = json.loads( | |
requests.get("https://api.beta.ons.gov.uk/v1/datasets", verify=False).text | |
) | |
# Suppress warnings of class type UserWarning | |
with warnings.catch_warnings(): | |
warnings.filterwarnings("ignore", category=UserWarning) | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment