Изучаю статью.
Код:
выдает ошибку:
Код:
Python:
import requests
from requests.exceptions import HTTPError
for url in ['https://api.github.com', 'https://api.github.com/invalid']:
try:
response = requests.get(url)
# если ответ успешен, исключения задействованы не будут
response.raise_for_status()
except HTTPError as http_err:
print(f'HTTP error occurred: {http_err}') # Python 3.6
except Exception as err:
print(f'Other error occurred: {err}') # Python 3.6
else:
print('Success!')
Код:
File "pars_regu.py", line 11
print(f'HTTP error occurred: {http_err}') # Python 3.6
^
SyntaxError: invalid syntax