Converted Tab to Spaces

This commit is contained in:
duckie
2020-08-21 11:10:58 +05:30
committed by GitHub
parent 36a87ffbdd
commit 370bf7bfd9
3 changed files with 73 additions and 56 deletions

View File

@@ -1,12 +1,19 @@
import urllib3
import requests
from core.colors import bad
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Added better error handling.
# Added verbose options.
def requester(url, scheme, headers, origin):
headers['Origin'] = scheme + origin
response = requests.get(url, headers=headers, verify=False).headers
for key, value in response.items():
if key.lower() == 'access-control-allow-origin':
return response
try:
response = requests.get(url, headers=headers, verify=False).headers
for key, value in response.items():
if key.lower() == 'access-control-allow-origin':
return response
except requests.exceptions.RequestException as e:
if 'Failed to establish a new connection' in str(e):
print ( ' ' + bad + ' ' + url + ' seems to be down')