flake8 style

This commit is contained in:
Itamar Friedman
2023-04-13 00:04:08 +03:00
parent 9f972f4ee9
commit bf3c76ced7
3 changed files with 13 additions and 12 deletions

View File

@@ -32,7 +32,7 @@ def get_response(url, headers=cfg.user_agent_header, timeout=10):
# Restrict access to local files
if check_local_file_access(url):
raise ValueError('Access to local files is restricted')
# Most basic check if the URL is valid:
if not url.startswith('http://') and not url.startswith('https://'):
raise ValueError('Invalid URL format')
@@ -44,7 +44,7 @@ def get_response(url, headers=cfg.user_agent_header, timeout=10):
# Check if the response contains an HTTP error
if response.status_code >= 400:
return None, "Error: HTTP " + str(response.status_code) + " error"
return response, None
except ValueError as ve:
# Handle invalid URL format