global settings and work on test website
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import requests
|
||||
from django.conf import settings
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
|
||||
def test_website(url_website,bool_proxy=False):
|
||||
try:
|
||||
if bool_proxy:
|
||||
status = requests.get(url_website,proxies=settings.PROXIES)
|
||||
else:
|
||||
status = requests.get(url_website).status_code
|
||||
|
||||
except requests.exceptions.ConnectionError:
|
||||
status = "ConnectionError"
|
||||
|
||||
#identify the exception name
|
||||
except Exception as err:
|
||||
print(f"{type(err).__name__} was raised: {err}")
|
||||
status = "exception not targeted"
|
||||
return status
|
||||
Reference in New Issue
Block a user