I'm trying to tell my script to get contents from a url or otherwise log it as an error.
I saw an example in Correct way to try/except using Python requests module? but it does not seem to work for the url in the code below.
The url is broken so I would expect the script to do the except block and log the error. It just gets stuck with no results or error.
import requests
import sys
url = 'https://m.sportsinteraction.com/fr/football/international/coupe-du-monde-feminine-pari/fifawomen-wc-219-reach-the-semi-finals-scotland-05-21-2019-322-1609228/'
try:
r = requests.get(url)
except requests.exceptions.RequestException as e:
print (e)
sys.exit(1)
Below is a snip of the error I get: