I have a python script sending requests to several urls in order to analyze potential scam.
Below a snippet of my code:
for domain in domains:
if ...
# Analyzing the domain
logging.info('Analyzing ' + domain)
try:
# Send a GET request to the domain
url = 'https://' + domain
response = session.get(url, timeout=CONN_TIMEOUT)
status = response.status_code
if status == 200 or status == 301 or status == 302:
[...]
else:
logging.debug('Request towards ' + domain + ' returns the following status code: ' + str(response.status_code))
except requests.exceptions.ReadTimeout as e:
status = 'Read Timeout'
logging.warning('Request for ' + domain + ' timed out: ' + status)
except requests.exceptions.ProxyError as e:
status = 'Proxy Error'
logging.error('Request for ' + domain + ' failed: ' + status)
except requests.exceptions.ConnectTimeout as e:
status = 'Connect Timeout'
logging.warning('Request for ' + domain + ' timed out: ' + status)
except requests.exceptions.ConnectionError as e:
status = 'Connection Error'
logging.error('Request for ' + domain + ' failed: ' + status)
finally:
[...]
return results
Sometimes my script pauses, so I need to press the Enter key to continue. Below a sample log of the "freeze" event (at 10:20:45 after the analysis of xxxxx2.com). The I pressed the Enter key at 10:49:22 and it continued the execution.
2023-02-10 10:20:42,080 [INFO] Analyzing xxxxx1.com
2023-02-10 10:20:42,648 [INFO] Analyzing xxxxx2.com
2023-02-10 10:20:45,678 [ERROR] Request for xxxxx2.com failed: Proxy Error
2023-02-10 10:49:19,152 [INFO] Analyzing xxxxx3.com
2023-02-10 10:49:22,169 [ERROR] Request for xxxxx3.com failed: Proxy Error
2023-02-10 10:49:22,170 [INFO] Analyzing xxxxx4.website
2023-02-10 10:49:24,062 [WARNING] Certificate did not match expected hostname: xxxxx4.website.
Any idea about this issue?