Python code gives error but is not called by me? - python

Below is my Python script in a file called P2_small.py, trimmed down and simplified to not make it wieldy. Basically it sets up an infinite loop each time calling yfinance to get data within a try/except construct. When the internet goes down, I get the error below. Two likely related questions:
How come that the stackdump does not mention my script (as you can see it refers to all sorts of .py files but never to P2_small.py)?
Why does this error not get trapped by my try/except construct?
Code in P2_small.py:
import requests
from tkinter import *
import yfinance as yf
def isInternet(): #Method to check there is a good internet connection
url = 'http://www.google.com/'
try:
_ = requests.get(url, timeout=3)
return True
except requests.ConnectionError:
return False
def startInfiniteLoop():
try:
if not isInternet():
print("No internet connection - waiting...");
else:
df = yf.download(tickers="RDSB.L", period="1y", interval="1d", auto_adjust=True, prepost=False)
if df.empty:
print("Does not exist")
else:
print(df.info)
# Call startInfiniteLoop() again and again and again, each time after 10 secs
root.after(10000, startInfiniteLoop)
except Exception as exception1:
print("Error1 occured: " + str(exception1))
#Make GUI
root = Tk()
root.geometry("300x3000")
#Start infinite loop and show the GUI
root.after(100, startInfiniteLoop)
root.mainloop()
Errors generated:
Exception in thread Thread-1225:
Traceback (most recent call last):
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 96, in create_connection
raise err
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 86, in create_connection
sock.connect(sa)
OSError: [WinError 10065] A socket operation was attempted to an unreachable host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 353, in connect
conn = self._new_conn()
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000002518AA6B100>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='query2.finance.yahoo.com', port=443): Max retries exceeded with url: /v8/finance/chart/SAF.PA?range=0d&interval=1d&includePrePost=False&events=div%2Csplits (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002518AA6B100>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\multitasking\__init__.py", line 102, in _run_via_pool
return callee(*args, **kwargs)
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\yfinance\multi.py", line 169, in _download_one_threaded
data = _download_one(ticker, start, end, auto_adjust, back_adjust,
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\yfinance\multi.py", line 181, in _download_one
return Ticker(ticker).history(period=period, interval=interval,
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\yfinance\base.py", line 152, in history
data = self.session.get(
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\mkemp\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='query2.finance.yahoo.com', port=443): Max retries exceeded with url: /v8/finance/chart/SAF.PA?range=0d&interval=1d&includePrePost=False&events=d

Related

Failed to generate list of vault tokens

Looking for a solution to the problem to identify the vault root tokens, I found the following documentation
https://www.greenreedtech.com/identifying-active-hashicorp-vault-root-tokens/
The script related in this link worked in a vault instance that I have in version 1.5.4, but i have a problem listing the vault tokens in version 1.6.1
Traceback (most recent call last):
File "/home/vault/tokenlist-prod.py", line 31, in <module>
output = client.lookup_token(key, accessor=True)
File "/usr/local/lib/python3.10/dist-packages/hvac/v1/__init__.py", line 444, in lookup_token
return self._adapter.post(path, json=accessor_param, wrap_ttl=wrap_ttl)
File "/usr/local/lib/python3.10/dist-packages/hvac/adapters.py", line 126, in post
return self.request("post", url, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/hvac/adapters.py", line 364, in request
response = super(JSONAdapter, self).request(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/hvac/adapters.py", line 330, in request
utils.raise_for_error(
File "/usr/local/lib/python3.10/dist-packages/hvac/utils.py", line 41, in raise_for_error
raise exceptions.Forbidden(message, errors=errors, method=method, url=url)
hvac.exceptions.Forbidden: 1 error occurred:
* permission denied
, on post https://mydomain/v1/auth/token/lookup-accessor
python3 tokenlist-alter.py
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 704, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 399, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/lib/python3.10/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
self.send(msg)
File "/usr/lib/python3.10/http/client.py", line 975, in send
self.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f398c14cd60>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send
resp = conn.urlopen(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 786, in urlopen
retries = retries.increment(
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=54453): Max retries exceeded with url: /v1/auth/token/accessors?list=True (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f398c14cd60>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/vault/tokenlist-alter.py", line 25, in <module>
payload = client.list('auth/token/accessors')
File "/usr/local/lib/python3.10/dist-packages/hvac/v1/__init__.py", line 253, in list
return self._adapter.get("/v1/{0}".format(path), params=payload)
File "/usr/local/lib/python3.10/dist-packages/hvac/adapters.py", line 113, in get
return self.request("get", url, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/hvac/adapters.py", line 364, in request
response = super(JSONAdapter, self).request(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/hvac/adapters.py", line 313, in request
response = self.session.request(
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=54453): Max retries exceeded with url: /v1/auth/token/accessors?list=True (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f398c14cd60>: Failed to establish a new connection: [Errno 111] Connection refused'))
The token I use to run the script is a root token
the urls i use have ssl certificate
Could someone help me with this problem?
Share my Script Script Py
Share Script
#!/usr/local/bin/python3
import os
import time
import hvac
import urllib3
from prettytable import PrettyTable
urllib3.disable_warnings()
try:
os.environ["VAULT_ADDR"] = "https://vault.test.com"
except Exception:
print("The VAULT_ADDR environment must be set.")
os._exit(1)
try:
os.environ["VAULT_TOKEN"] = "lalala"
except Exception:
print("The VAULT_TOKEN environment must be set.")
os._exit(1)
client = hvac.Client(url=os.environ['VAULT_ADDR'], verify=False, token=os.environ["VAULT_TOKEN"])
payload = client.list('auth/token/accessors')
keys = payload['data']['keys']
x = PrettyTable()
x.field_names = ["Display Name", "Creation Time", "Expiration Time", "Policies", "Token Accessor"]
for key in keys:
output = client.lookup_token(key, accessor=True)
display_name = output['data']['display_name']
creation_date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(output['data']['creation_time']))
expire_time = output['data']['expire_time']
policies = output['data']['policies']
accessor = key
if "root" in policies:
x.add_row([display_name, creation_date, expire_time, policies, accessor])
print(x)

TimeoutError: [Errno 110] Connection timed out-Api testing

I am trying to run python behave feature file in python for API testing. The code works fine in Pycharm but not in Gitlab CI. It shows
Given Set Get Route api endpoint as /api/Tourist/26 # steps/stepImplementation.py:15
When we send GET HTTP Status request to api # steps/stepImplementation.py:21
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 179, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f9936df5150>, 'Connection to kyc.api.prev.validatis.de timed out. (connect timeout=None)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 440, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='kyc.api.prev.validatis.de', port=443): Max retries exceeded with url: /validatis/v1.16.0 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f9936df5150>, 'Connection to ---------- timed out. (connect timeout=None)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/behave/model.py", line 1329, in run
match.run(runner.context)
File "/usr/local/lib/python3.10/site-packages/behave/matchers.py", line 98, in run
self.func(context, *args, **kwargs)
File "steps/stepImplementation.py", line 23, in step_impl
context.response = requests.get(context.url)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 507, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='kyc.api.prev.validatis.de', port=443): Max retries exceeded with url: ------ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f9936df5150>, 'Connection to ----------- timed out. (connect timeout=None)'))
Then The valid response of status code be 200 # None
Gitlab yml file
image: "python:3.10"
before_script:
python --version
pip install -r requirements.txt
stages:
- test
python_behave_tests:
stage: test
script:
- cd features
- behave TestApi.feature --no-capture
- behave GetApiOperationModeStatus.feature --no-capture
Is it the problem with my code or with the yml file or gitlab CI. But my code works in local environment.

How to make it so a GET request using the Python request library never causes the program to fail?

I currently have the following method implemented that is meant to make a GET request (indefinitely until the call is successful in the event that the call is not successful):
def request_with_error_handling(self, url, filename):
current_datetime = str(datetime.now()).replace(" ", "_").replace(":",
".")
try:
rq = requests.get(url, headers=headers, proxies=random_proxy())
except Exception as e:
self.send_error_message(f"{url} - {filename}" + str(e))
retries = 0
while rq.status_code != 200:
retries += 1
try:
rq = requests.get(url, headers=headers, proxies=random_proxy())
except Exception as e:
self.send_error_message(f"{url} - {filename}" + str(e))
if retries == 4:
with open(filename + current_datetime, "w",
encoding="utf-8") as text_file:
text_file.write(rq.text)
self.send_error_message("Max retries exceeded error")
time.sleep(60)
retries = 0
return rq
My thought would be that this program would never fail as a result of a failed GET request, because I am wrapping every single GET request in a try catch block that should catch any exception, however, I am very occasionally getting some errors that cause the program to fail and I am not sure what I can do to stop the program from doing so.
Here is part of the the latest stack trace that caused one of my threads to fail. I could not post the whole thing, since it was well over the 30k character limit allowed by stack overflow. It over 100k in characters:
Exception in thread Thread-57720:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\contrib\pyopenssl.py", line 488, in wrap_socket
cnx.do_handshake()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenSSL\SSL.py", line 1934, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenSSL\SSL.py", line 1663, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (10053, 'WSAECONNABORTED')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
self._prepare_proxy(conn)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 932, in _prepare_proxy
conn.connect()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 371, in connect
ssl_context=context,
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\ssl_.py", line 384, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\contrib\pyopenssl.py", line 494, in wrap_socket
raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: SysCallError(10053, 'WSAECONNABORTED')",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.random_website_test_blah_blah_blah43149676132846.co.uk', port=443): Max retries exceeded with url: /sch//blah3&_sop=10&_ipg=200&rt=nc (Caused by SSLError(SSLError("bad handshake: SysCallError(10053, 'WSAECONNABORTED')")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 93, in request_with_error_handling
rq = requests.get(url, headers=headers, proxies=random_proxy())
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.random_website_test_blah_blah_blah43149676132846.co.uk', port=443): Max retries exceeded with url: /sch//blah3&_sop=10&_ipg=200&rt=nc (Caused by SSLError(SSLError("bad handshake: SysCallError(10053, 'WSAECONNABORTED')")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 677, in urlopen
chunked=chunked,
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
conn.connect()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 309, in connect
conn = self._new_conn()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 172, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x14C92E30>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='discord.com', port=443): Max retries exceeded with url: /api/webhooks/817872766140153857/QEOUFVJSlKdCuf4suHb-J6_LvPB6-0R0Taq9IONrUxj-jWODWhBlXh0WBLNPXtS0F5hk?wait=True (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x14C92E30>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 260, in consecutive_scrape
page)
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 95, in request_with_error_handling
self.send_discord_error(f"{url} - {filename}, {page}" + str(e))
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 87, in send_discord_error
response = webhook.execute()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord_webhook\webhook.py", line 142, in execute
response = requests.post(url, json=self.json, proxies=self.proxies, params={'wait': True})
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='discord.com', port=443): Max retries exceeded with url: /api/webhooks/817872766140153857/QEOUFVJSlKdCuf4suHb-J6_LvPB6-0R0Taq9IONrUxj-jWODWhBlXh0WBLNPXtS0F5hk?wait=True (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x14C92E30>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))
Exception in thread Thread-57723:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\contrib\pyopenssl.py", line 488, in wrap_socket
cnx.do_handshake()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenSSL\SSL.py", line 1934, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenSSL\SSL.py", line 1663, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (10053, 'WSAECONNABORTED')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
self._prepare_proxy(conn)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 932, in _prepare_proxy
conn.connect()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 371, in connect
ssl_context=context,
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\ssl_.py", line 384, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\contrib\pyopenssl.py", line 494, in wrap_socket
raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: SysCallError(10053, 'WSAECONNABORTED')",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.random_website_test_blah_blah_blah43149676132846.co.uk', port=443): Max retries exceeded with url: /blah (Caused by SSLError(SSLError("bad handshake: SysCallError(10053, 'WSAECONNABORTED')")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 93, in request_with_error_handling
rq = requests.get(url, headers=headers, proxies=random_proxy())
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.random_website_test_blah_blah_blah43149676132846.co.uk', port=443): Max retries exceeded with url: /blah (Caused by SSLError(SSLError("bad handshake: SysCallError(10053, 'WSAECONNABORTED')")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 677, in urlopen
chunked=chunked,
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
conn.connect()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 309, in connect
conn = self._new_conn()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 172, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x14C92890>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='discord.com', port=443): Max retries exceeded with url: /api/webhooks/817872766140153857/QEOUFVJSlKdCuf4suHb-J6_LvPB6-0R0Taq9IONrUxj-jWODWhBlXh0WBLNPXtS0F5hk?wait=True (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x14C92890>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 260, in consecutive_scrape
page)
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 95, in request_with_error_handling
self.send_discord_error(f"{url} - {filename}, {page}" + str(e))
File "C:/Users/user/PycharmProjects/random_website_test_blah_blah_blah43149676132846/restocks/restock_monitor.py", line 87, in send_discord_error
response = webhook.execute()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord_webhook\webhook.py", line 142, in execute
response = requests.post(url, json=self.json, proxies=self.proxies, params={'wait': True})
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='discord.com', port=443): Max retries exceeded with url: /api/webhooks/817872766140153857/QEOUFVJSlKdCuf4suHb-J6_LvPB6-0R0Taq9IONrUxj-jWODWhBlXh0WBLNPXtS0F5hk?wait=True (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x14C92890>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))
Exception in thread Thread-57719:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\contrib\pyopenssl.py", line 488, in wrap_socket
cnx.do_handshake()
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenSSL\SSL.py", line 1934, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\OpenSSL\SSL.py", line 1663, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (10053, 'WSAECONNABORTED')
During handling of the above exception, another exception occurred:
You will need to catch the error as well:
try:
rq = requests.get(url, headers=headers, proxies=random_proxy())
except Exception as e:
self.send_error_message(f"{url} - {filename}" + str(e))
except requests.exceptions.SSLError as er:
self.send_error_message(f"{url} - {filename}" + str(er))
How to log error, you would need better but here are few functions that you can use to based your decision on:
er = SystemError("My error")
tr(er)
'My error'
er.args
('My error',)
UPDATE:
This is working snippet:
import requests
url = "abc"
filename = "xyz"
try:
# rq = requests.get(url, headers=headers, proxies=random_proxy())
raise requests.exceptions.SSLError("Handshake!")
except Exception as e:
print(f"{url} - {filename}" + str(e))
except requests.exceptions.SSLError as er:
print(f"{url} - {filename}" + str(er))
# Output: abc - xyzHandshake!
UPDATE 2:
Code on the GitHub

AWS Glue | API call | Python Shell | Connection | Failed to establish a new connection: [Errno 110] Connection timed out

We are trying to call An API using Python Shell in AWS glue. We are making an HTTPS call using python 3.6 using "requests" library. The issue is pertaining to AWS glue.
The Job config is
Python Shell
Python 3 ( Glue Version 1.0 )
This is the error that we get
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 309, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 172, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f862b3b4160>: Failed to establish a new connection: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 446, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xyz.com', port=443): Max retries exceeded with url: /api-v2/client/orders/?auth_token=#####&start_date=01-04-2021&end_date=02-04-2021&status_filter=all&page_number=1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f862b3b4160>: Failed to establish a new connection: [Errno 110] Connection timed out',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/runscript.py", line 123, in <module>
runpy.run_path(temp_file_path, run_name='__main__')
File "/usr/local/lib/python3.6/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/usr/local/lib/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/tmp/glue-python-scripts-fhh0x612/test.py", line 16, in <module>
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xyz.com', port=443): Max retries exceeded with url: /api-v2/client/orders/?auth_token=#####0&start_date=01-04-2021&end_date=02-04-2021&status_filter=all&page_number=1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f862b3b4160>: Failed to establish a new connection: [Errno 110] Connection timed out',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/runscript.py", line 142, in <module>
raise e_type(e_value).with_traceback(new_stack)
File "/tmp/glue-python-scripts-fhh0x612/test.py", line 16, in <module>
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xyz.com', port=443): Max retries exceeded with url: /api-v2/client/orders/?auth_token=####&start_date=01-04-2021&end_date=02-04-2021&status_filter=all&page_number=1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f862b3b4160>: Failed to establish a new connection: [Errno 110] Connection timed out',))
Is there an issue with the security group that AWS Glue refers to or some issue with the API call. We are not able to figure out.
Is there more than one connection from glue? like calling S3 , redshift...etc. if more than one then u may have to add other connections in connection properties. Edit job -> add connection.

My neverending 'while' loop is running but gets terminated by trace backs exactly at the 'important' iterations. Opensea sales fetcher bot

I've been making a discord webhook that where there's a new sale on Opensea of an NFT out of my NFT collection, it fetches it and sends it into discord through the webhook.
The only problem is, is that I needed to do that in a never-ending loop, since Opensea's API doesn't provide 'streaming', and only one time requests.
Long story short, the program sends the recent sales to the discord at its first iteration of the while loop, but after the first, it seems as it's not catching them anymore.
safe to mention that openSea.get_response(After, Before) and other functions like AssettoEmbed and BundletoEmbed and the actual content of distribute(After, Before) are functions which work on the first iteration. All work correctly as I've tested it several times and it has been working since the start of this little project.
so my main concerns which could be the cause of this issue are:
the asynchronous code
opening a new session with every call of distribute()
If any of you guys have an idea as to why it doesn't actually catch sales after the first iteration of the loop, I would love to hear it.
here's the main function that I run in-order to start the sale fetching:
(I've written it in asynchronous code which I didn't need to do. please ignore).
async def start():
print("session starting")
while True:
await distribute(datetime.datetime.fromisoformat(db['timestampAfter']), datetime.datetime.fromisoformat(db['timestampBefore']))
db['timestampAfter'] = db['timestampBefore']
db['timestampBefore'] = datetime.datetime.now().isoformat()
await asyncio.sleep(10)
print("session died")
async def distribute(After=None, Before=None):
book = openSea.get_response(After, Before)
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url(hook, adapter=AsyncWebhookAdapter(session))
for sale in book:
if sale['asset'] != None:
await webhook.send(embed=AssettoEmbed(sale))
elif sale['asset_bundle'] != None:
await webhook.send(embeds=BundletoEmbed(sale))
def get_response(After, Before):
response = requests.request("GET", url, params={**querystring, **{"occurred_before":Before, "occurred_after":After}})
sales = json.loads(response.text)
return sales["asset_events"][::-1]
important edit:
I've caught these tracebacks on the cloud source that I'm running this program at (repl.it); They occur every once in a few hours, and ironically before sales:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f9ae5a4f760>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/urllib3/util/retry.py", line 573, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='kv.replit.com', port=443): Max retries exceeded with url: /v0/eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MTcxNjgwNzEsImlhdCI6MTYxNzA1NjQ3MSwiaXNzIjoiY29ubWFuIiwiZGF0YWJhc2VfaWQiOiIzOTAwZTk5NS0zNTRjLTQ4NmQtOTU5NC03YjY5MDZmMmM0NzEifQ.DzSMWXog6bqPhfC74A-zzmDDIQxaPMsNDiTArcWdg8wX07EI090XPxSEs7vtdgJU83EU2Jx6hLh1ZvF5xl-qcw/timestampAfter (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9ae5a4f760>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 6, in <module>
asyncio.run(start())
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/runner/Cryptomon-Sales-Bot/distributing.py", line 108, in start
await distribute(datetime.datetime.fromisoformat(db['timestampAfter']), datetime.datetime.fromisoformat(db['timestampBefore']))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 434, in __getitem__
raw_val = self.get_raw(key)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 472, in get_raw
r = self.sess.get(self.db_url + "/" + urllib.parse.quote(key))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='kv.replit.com', port=443): Max retries exceeded with url: /v0/eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MTcxNjgwNzEsImlhdCI6MTYxNzA1NjQ3MSwiaXNzIjoiY29ubWFuIiwiZGF0YWJhc2VfaWQiOiIzOTAwZTk5NS0zNTRjLTQ4NmQtOTU5NC03YjY5MDZmMmM0NzEifQ.DzSMWXog6bqPhfC74A-zzmDDIQxaPMsNDiTArcWdg8wX07EI090XPxSEs7vtdgJU83EU2Jx6hLh1ZvF5xl-qcw/timestampAfter (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9ae5a4f760>: Failed to establish a new connection: [Errno 111] Connection refused'))

Categories