Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LefterisJP/d4b336126a9233395b25b62b25cb0d8a to your computer and use it in GitHub Desktop.
Save LefterisJP/d4b336126a9233395b25b62b25cb0d8a to your computer and use it in GitHub Desktop.
beaconchain_connection_error_in_the_ci.txt
2021-05-22T00:06:09.0642770Z
2021-05-22T00:06:09.0643445Z =================================== FAILURES ===================================
2021-05-22T00:06:09.0644227Z _______________________ test_get_balance_history_single ________________________
2021-05-22T00:06:09.0644818Z
2021-05-22T00:06:09.0645985Z self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.0647570Z conn = <urllib3.connection.HTTPSConnection object at 0x7f8504a99850>
2021-05-22T00:06:09.0649442Z method = 'GET', url = '/api/v1/validator/9/balancehistory'
2021-05-22T00:06:09.0650482Z timeout = Timeout(connect=5, read=30, total=None), chunked = False
2021-05-22T00:06:09.0652153Z httplib_request_kw = {'body': None, 'headers': {'User-Agent': 'rotkehlchen', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}}
2021-05-22T00:06:09.0653509Z timeout_obj = Timeout(connect=5, read=30, total=None), read_timeout = 30
2021-05-22T00:06:09.0655360Z
2021-05-22T00:06:09.0655950Z def _make_request(
2021-05-22T00:06:09.0656775Z self, conn, method, url, timeout=_Default, chunked=False, **httplib_request_kw
2021-05-22T00:06:09.0657510Z ):
2021-05-22T00:06:09.0657973Z """
2021-05-22T00:06:09.0658701Z Perform a request on a given urllib connection object taken from our
2021-05-22T00:06:09.0659433Z pool.
2021-05-22T00:06:09.0659911Z
2021-05-22T00:06:09.0660398Z :param conn:
2021-05-22T00:06:09.0661087Z a connection from one of our connection pools
2021-05-22T00:06:09.0661716Z
2021-05-22T00:06:09.0662216Z :param timeout:
2021-05-22T00:06:09.0663172Z Socket timeout in seconds for the request. This can be a
2021-05-22T00:06:09.0664062Z float or integer, which will set the same timeout value for
2021-05-22T00:06:09.0664938Z the socket connect and the socket read, or an instance of
2021-05-22T00:06:09.0666233Z :class:`urllib3.util.Timeout`, which gives you more fine-grained
2021-05-22T00:06:09.0667106Z control over your timeouts.
2021-05-22T00:06:09.0667678Z """
2021-05-22T00:06:09.0668215Z self.num_requests += 1
2021-05-22T00:06:09.0668760Z
2021-05-22T00:06:09.0669371Z timeout_obj = self._get_timeout(timeout)
2021-05-22T00:06:09.0670078Z timeout_obj.start_connect()
2021-05-22T00:06:09.0670837Z conn.timeout = timeout_obj.connect_timeout
2021-05-22T00:06:09.0671459Z
2021-05-22T00:06:09.0672088Z # Trigger any extra validation we need to do.
2021-05-22T00:06:09.0672708Z try:
2021-05-22T00:06:09.0673279Z self._validate_conn(conn)
2021-05-22T00:06:09.0674055Z except (SocketTimeout, BaseSSLError) as e:
2021-05-22T00:06:09.0674987Z # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
2021-05-22T00:06:09.0675968Z self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
2021-05-22T00:06:09.0676822Z raise
2021-05-22T00:06:09.0677292Z
2021-05-22T00:06:09.0678004Z # conn.request() calls http.client.*.request, not the method in
2021-05-22T00:06:09.0678949Z # urllib3.request. It also calls makefile (recv) on the socket.
2021-05-22T00:06:09.0679674Z try:
2021-05-22T00:06:09.0680319Z if chunked:
2021-05-22T00:06:09.0681079Z conn.request_chunked(method, url, **httplib_request_kw)
2021-05-22T00:06:09.0681789Z else:
2021-05-22T00:06:09.0682470Z conn.request(method, url, **httplib_request_kw)
2021-05-22T00:06:09.0683115Z
2021-05-22T00:06:09.0683897Z # We are swallowing BrokenPipeError (errno.EPIPE) since the server is
2021-05-22T00:06:09.0684995Z # legitimately able to close the connection after sending a valid response.
2021-05-22T00:06:09.0686017Z # With this behaviour, the received response is still readable.
2021-05-22T00:06:09.0686994Z except BrokenPipeError:
2021-05-22T00:06:09.0687977Z # Python 3
2021-05-22T00:06:09.0697856Z pass
2021-05-22T00:06:09.0704007Z except IOError as e:
2021-05-22T00:06:09.0704931Z # Python 2 and macOS/Linux
2021-05-22T00:06:09.0705736Z # EPIPE and ESHUTDOWN are BrokenPipeError on Python 2, and EPROTOTYPE is needed on macOS
2021-05-22T00:06:09.0707801Z # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
2021-05-22T00:06:09.0709138Z if e.errno not in {
2021-05-22T00:06:09.0710687Z errno.EPIPE,
2021-05-22T00:06:09.0711204Z errno.ESHUTDOWN,
2021-05-22T00:06:09.0711742Z errno.EPROTOTYPE,
2021-05-22T00:06:09.0712211Z }:
2021-05-22T00:06:09.0712574Z raise
2021-05-22T00:06:09.0712913Z
2021-05-22T00:06:09.0713396Z # Reset the timeout for the recv() on the socket
2021-05-22T00:06:09.0714023Z read_timeout = timeout_obj.read_timeout
2021-05-22T00:06:09.0714497Z
2021-05-22T00:06:09.0715124Z # App Engine doesn't have a sock attr
2021-05-22T00:06:09.0715664Z if getattr(conn, "sock", None):
2021-05-22T00:06:09.0716311Z # In Python 3 socket.py will catch EAGAIN and return None when you
2021-05-22T00:06:09.0717121Z # try and read into the file pointer created by http.client, which
2021-05-22T00:06:09.0717974Z # instead raises a BadStatusLine exception. Instead of catching
2021-05-22T00:06:09.0718873Z # the exception and assuming all BadStatusLine exceptions are read
2021-05-22T00:06:09.0719733Z # timeouts, check for a zero timeout before making the request.
2021-05-22T00:06:09.0720687Z if read_timeout == 0:
2021-05-22T00:06:09.0721241Z raise ReadTimeoutError(
2021-05-22T00:06:09.0721916Z self, url, "Read timed out. (read timeout=%s)" % read_timeout
2021-05-22T00:06:09.0722459Z )
2021-05-22T00:06:09.0722987Z if read_timeout is Timeout.DEFAULT_TIMEOUT:
2021-05-22T00:06:09.0723867Z conn.sock.settimeout(socket.getdefaulttimeout())
2021-05-22T00:06:09.0724623Z else: # None or a value
2021-05-22T00:06:09.0725287Z conn.sock.settimeout(read_timeout)
2021-05-22T00:06:09.0725741Z
2021-05-22T00:06:09.0726140Z # Receive the response from the server
2021-05-22T00:06:09.0726571Z try:
2021-05-22T00:06:09.0726868Z try:
2021-05-22T00:06:09.0727326Z # Python 2.7, use buffering of HTTP responses
2021-05-22T00:06:09.0727977Z httplib_response = conn.getresponse(buffering=True)
2021-05-22T00:06:09.0728569Z except TypeError:
2021-05-22T00:06:09.0728961Z # Python 3
2021-05-22T00:06:09.0729301Z try:
2021-05-22T00:06:09.0729769Z httplib_response = conn.getresponse()
2021-05-22T00:06:09.0730429Z except BaseException as e:
2021-05-22T00:06:09.0731021Z # Remove the TypeError from the exception chain in
2021-05-22T00:06:09.0731709Z # Python 3 (including for exceptions like SystemExit).
2021-05-22T00:06:09.0732336Z # Otherwise it looks like a bug in the code.
2021-05-22T00:06:09.0732823Z > six.raise_from(e, None)
2021-05-22T00:06:09.0733106Z
2021-05-22T00:06:09.0735434Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/connectionpool.py:445:
2021-05-22T00:06:09.0736152Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0736408Z
2021-05-22T00:06:09.0736767Z value = None, from_value = None
2021-05-22T00:06:09.0738203Z
2021-05-22T00:06:09.0738496Z > ???
2021-05-22T00:06:09.0738694Z
2021-05-22T00:06:09.0738977Z <string>:3:
2021-05-22T00:06:09.0739334Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0739585Z
2021-05-22T00:06:09.0743314Z self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.0744518Z conn = <urllib3.connection.HTTPSConnection object at 0x7f8504a99850>
2021-05-22T00:06:09.0745535Z method = 'GET', url = '/api/v1/validator/9/balancehistory'
2021-05-22T00:06:09.0746190Z timeout = Timeout(connect=5, read=30, total=None), chunked = False
2021-05-22T00:06:09.0747371Z httplib_request_kw = {'body': None, 'headers': {'User-Agent': 'rotkehlchen', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}}
2021-05-22T00:06:09.0748341Z timeout_obj = Timeout(connect=5, read=30, total=None), read_timeout = 30
2021-05-22T00:06:09.0748730Z
2021-05-22T00:06:09.0749064Z def _make_request(
2021-05-22T00:06:09.0749653Z self, conn, method, url, timeout=_Default, chunked=False, **httplib_request_kw
2021-05-22T00:06:09.0750190Z ):
2021-05-22T00:06:09.0750465Z """
2021-05-22T00:06:09.0750985Z Perform a request on a given urllib connection object taken from our
2021-05-22T00:06:09.0751504Z pool.
2021-05-22T00:06:09.0752776Z
2021-05-22T00:06:09.0753090Z :param conn:
2021-05-22T00:06:09.0753578Z a connection from one of our connection pools
2021-05-22T00:06:09.0754007Z
2021-05-22T00:06:09.0754342Z :param timeout:
2021-05-22T00:06:09.0754861Z Socket timeout in seconds for the request. This can be a
2021-05-22T00:06:09.0755516Z float or integer, which will set the same timeout value for
2021-05-22T00:06:09.0756168Z the socket connect and the socket read, or an instance of
2021-05-22T00:06:09.0757079Z :class:`urllib3.util.Timeout`, which gives you more fine-grained
2021-05-22T00:06:09.0757827Z control over your timeouts.
2021-05-22T00:06:09.0758203Z """
2021-05-22T00:06:09.0758566Z self.num_requests += 1
2021-05-22T00:06:09.0758909Z
2021-05-22T00:06:09.0759319Z timeout_obj = self._get_timeout(timeout)
2021-05-22T00:06:09.0759822Z timeout_obj.start_connect()
2021-05-22T00:06:09.0760458Z conn.timeout = timeout_obj.connect_timeout
2021-05-22T00:06:09.0760886Z
2021-05-22T00:06:09.0761315Z # Trigger any extra validation we need to do.
2021-05-22T00:06:09.0761750Z try:
2021-05-22T00:06:09.0762117Z self._validate_conn(conn)
2021-05-22T00:06:09.0762674Z except (SocketTimeout, BaseSSLError) as e:
2021-05-22T00:06:09.0763368Z # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
2021-05-22T00:06:09.0764120Z self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
2021-05-22T00:06:09.0764632Z raise
2021-05-22T00:06:09.0764935Z
2021-05-22T00:06:09.0765428Z # conn.request() calls http.client.*.request, not the method in
2021-05-22T00:06:09.0766151Z # urllib3.request. It also calls makefile (recv) on the socket.
2021-05-22T00:06:09.0766660Z try:
2021-05-22T00:06:09.0767069Z if chunked:
2021-05-22T00:06:09.0767604Z conn.request_chunked(method, url, **httplib_request_kw)
2021-05-22T00:06:09.0768096Z else:
2021-05-22T00:06:09.0768579Z conn.request(method, url, **httplib_request_kw)
2021-05-22T00:06:09.0769022Z
2021-05-22T00:06:09.0769585Z # We are swallowing BrokenPipeError (errno.EPIPE) since the server is
2021-05-22T00:06:09.0770399Z # legitimately able to close the connection after sending a valid response.
2021-05-22T00:06:09.0771177Z # With this behaviour, the received response is still readable.
2021-05-22T00:06:09.0771805Z except BrokenPipeError:
2021-05-22T00:06:09.0772240Z # Python 3
2021-05-22T00:06:09.0772576Z pass
2021-05-22T00:06:09.0772947Z except IOError as e:
2021-05-22T00:06:09.0773383Z # Python 2 and macOS/Linux
2021-05-22T00:06:09.0774060Z # EPIPE and ESHUTDOWN are BrokenPipeError on Python 2, and EPROTOTYPE is needed on macOS
2021-05-22T00:06:09.0775722Z # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
2021-05-22T00:06:09.0776866Z if e.errno not in {
2021-05-22T00:06:09.0777285Z errno.EPIPE,
2021-05-22T00:06:09.0777718Z errno.ESHUTDOWN,
2021-05-22T00:06:09.0778203Z errno.EPROTOTYPE,
2021-05-22T00:06:09.0778599Z }:
2021-05-22T00:06:09.0778908Z raise
2021-05-22T00:06:09.0779216Z
2021-05-22T00:06:09.0779624Z # Reset the timeout for the recv() on the socket
2021-05-22T00:06:09.0780182Z read_timeout = timeout_obj.read_timeout
2021-05-22T00:06:09.0780583Z
2021-05-22T00:06:09.0781113Z # App Engine doesn't have a sock attr
2021-05-22T00:06:09.0781576Z if getattr(conn, "sock", None):
2021-05-22T00:06:09.0782165Z # In Python 3 socket.py will catch EAGAIN and return None when you
2021-05-22T00:06:09.0782866Z # try and read into the file pointer created by http.client, which
2021-05-22T00:06:09.0783618Z # instead raises a BadStatusLine exception. Instead of catching
2021-05-22T00:06:09.0784409Z # the exception and assuming all BadStatusLine exceptions are read
2021-05-22T00:06:09.0785144Z # timeouts, check for a zero timeout before making the request.
2021-05-22T00:06:09.0785698Z if read_timeout == 0:
2021-05-22T00:06:09.0786160Z raise ReadTimeoutError(
2021-05-22T00:06:09.0786757Z self, url, "Read timed out. (read timeout=%s)" % read_timeout
2021-05-22T00:06:09.0787218Z )
2021-05-22T00:06:09.0787692Z if read_timeout is Timeout.DEFAULT_TIMEOUT:
2021-05-22T00:06:09.0788531Z conn.sock.settimeout(socket.getdefaulttimeout())
2021-05-22T00:06:09.0789179Z else: # None or a value
2021-05-22T00:06:09.0789710Z conn.sock.settimeout(read_timeout)
2021-05-22T00:06:09.0790158Z
2021-05-22T00:06:09.0790573Z # Receive the response from the server
2021-05-22T00:06:09.0790987Z try:
2021-05-22T00:06:09.0791296Z try:
2021-05-22T00:06:09.0791738Z # Python 2.7, use buffering of HTTP responses
2021-05-22T00:06:09.0792400Z httplib_response = conn.getresponse(buffering=True)
2021-05-22T00:06:09.0792974Z except TypeError:
2021-05-22T00:06:09.0793382Z # Python 3
2021-05-22T00:06:09.0793708Z try:
2021-05-22T00:06:09.0794180Z > httplib_response = conn.getresponse()
2021-05-22T00:06:09.0794550Z
2021-05-22T00:06:09.0795404Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/connectionpool.py:440:
2021-05-22T00:06:09.0796127Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0796380Z
2021-05-22T00:06:09.0797025Z self = <urllib3.connection.HTTPSConnection object at 0x7f8504a99850>
2021-05-22T00:06:09.0797669Z
2021-05-22T00:06:09.0798039Z def getresponse(self):
2021-05-22T00:06:09.0798510Z """Get the response from the server.
2021-05-22T00:06:09.0798904Z
2021-05-22T00:06:09.0799380Z If the HTTPConnection is in the correct state, returns an
2021-05-22T00:06:09.0800093Z instance of HTTPResponse or of whatever object is returned by
2021-05-22T00:06:09.0800863Z the response_class variable.
2021-05-22T00:06:09.0801248Z
2021-05-22T00:06:09.0801718Z If a request has not been sent or if a previous response has
2021-05-22T00:06:09.0802404Z not be handled, ResponseNotReady is raised. If the HTTP
2021-05-22T00:06:09.0803136Z response indicates that the connection should be closed, then
2021-05-22T00:06:09.0803830Z it will be closed before the response is returned. When the
2021-05-22T00:06:09.0804517Z connection is closed, the underlying socket is closed.
2021-05-22T00:06:09.0804984Z """
2021-05-22T00:06:09.0805278Z
2021-05-22T00:06:09.0805771Z # if a prior response has been completed, then forget about it.
2021-05-22T00:06:09.0806468Z if self.__response and self.__response.isclosed():
2021-05-22T00:06:09.0807041Z self.__response = None
2021-05-22T00:06:09.0807412Z
2021-05-22T00:06:09.0807946Z # if a prior response exists, then it must be completed (otherwise, we
2021-05-22T00:06:09.0808938Z # cannot read this response's header to determine the connection-close
2021-05-22T00:06:09.0809540Z # behavior)
2021-05-22T00:06:09.0809855Z #
2021-05-22T00:06:09.0810583Z # note: if a prior response existed, but was connection-close, then the
2021-05-22T00:06:09.0811384Z # socket and response were made independent of this HTTPConnection
2021-05-22T00:06:09.0812118Z # object since a new request requires that we open a whole new
2021-05-22T00:06:09.0812638Z # connection
2021-05-22T00:06:09.0812963Z #
2021-05-22T00:06:09.0813422Z # this means the prior response had one of two states:
2021-05-22T00:06:09.0814058Z # 1) will_close: this connection was reset and the prior socket and
2021-05-22T00:06:09.0814690Z # response operate independently
2021-05-22T00:06:09.0815310Z # 2) persistent: the response was retained and we await its
2021-05-22T00:06:09.0815907Z # isclosed() status to become true.
2021-05-22T00:06:09.0816303Z #
2021-05-22T00:06:09.0816743Z if self.__state != _CS_REQ_SENT or self.__response:
2021-05-22T00:06:09.0817322Z raise ResponseNotReady(self.__state)
2021-05-22T00:06:09.0817763Z
2021-05-22T00:06:09.0818142Z if self.debuglevel > 0:
2021-05-22T00:06:09.0818859Z response = self.response_class(self.sock, self.debuglevel,
2021-05-22T00:06:09.0819521Z method=self._method)
2021-05-22T00:06:09.0819915Z else:
2021-05-22T00:06:09.0820473Z response = self.response_class(self.sock, method=self._method)
2021-05-22T00:06:09.0820979Z
2021-05-22T00:06:09.0821283Z try:
2021-05-22T00:06:09.0821598Z try:
2021-05-22T00:06:09.0821969Z > response.begin()
2021-05-22T00:06:09.0822262Z
2021-05-22T00:06:09.0822772Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/http/client.py:1369:
2021-05-22T00:06:09.0823353Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0823815Z
2021-05-22T00:06:09.0824345Z self = <http.client.HTTPResponse object at 0x7f8504609450>
2021-05-22T00:06:09.0824791Z
2021-05-22T00:06:09.0825115Z def begin(self):
2021-05-22T00:06:09.0825535Z if self.headers is not None:
2021-05-22T00:06:09.0826260Z # we've already started reading the response
2021-05-22T00:06:09.0826712Z return
2021-05-22T00:06:09.0827020Z
2021-05-22T00:06:09.0827550Z # read until we get a non-100 response
2021-05-22T00:06:09.0828075Z while True:
2021-05-22T00:06:09.0828541Z > version, status, reason = self._read_status()
2021-05-22T00:06:09.0828871Z
2021-05-22T00:06:09.0829392Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/http/client.py:310:
2021-05-22T00:06:09.0829954Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0830208Z
2021-05-22T00:06:09.0830736Z self = <http.client.HTTPResponse object at 0x7f8504609450>
2021-05-22T00:06:09.0831178Z
2021-05-22T00:06:09.0831506Z def _read_status(self):
2021-05-22T00:06:09.0832254Z > line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
2021-05-22T00:06:09.0832639Z
2021-05-22T00:06:09.0833146Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/http/client.py:271:
2021-05-22T00:06:09.0833730Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0833968Z
2021-05-22T00:06:09.0834408Z self = <socket.SocketIO object at 0x7f8504609550>
2021-05-22T00:06:09.0834911Z b = <memory at 0x7f85043542c0>
2021-05-22T00:06:09.0835162Z
2021-05-22T00:06:09.0835507Z def readinto(self, b):
2021-05-22T00:06:09.0836034Z """Read up to len(b) bytes into the writable buffer *b* and return
2021-05-22T00:06:09.0836875Z the number of bytes read. If the socket is non-blocking and no bytes
2021-05-22T00:06:09.0837483Z are available, None is returned.
2021-05-22T00:06:09.0837866Z
2021-05-22T00:06:09.0838525Z If *b* is non-empty, a 0 return value indicates that the connection
2021-05-22T00:06:09.0839109Z was shutdown at the other end.
2021-05-22T00:06:09.0839494Z """
2021-05-22T00:06:09.0839849Z self._checkClosed()
2021-05-22T00:06:09.0840423Z self._checkReadable()
2021-05-22T00:06:09.0840885Z if self._timeout_occurred:
2021-05-22T00:06:09.0841425Z raise OSError("cannot read from timed out object")
2021-05-22T00:06:09.0841879Z while True:
2021-05-22T00:06:09.0842220Z try:
2021-05-22T00:06:09.0842621Z > return self._sock.recv_into(b)
2021-05-22T00:06:09.0842919Z
2021-05-22T00:06:09.0843435Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/socket.py:589:
2021-05-22T00:06:09.0843985Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0844238Z
2021-05-22T00:06:09.0845153Z self = <gevent._ssl3.SSLSocket [closed] at 0x7f84f0f84450 server=False, cipher='' object [closed proxy at 0x7f8504ce9e30 fd=22 closed]>
2021-05-22T00:06:09.0845950Z buffer = <memory at 0x7f85043542c0>, nbytes = 8192, flags = 0
2021-05-22T00:06:09.0846279Z
2021-05-22T00:06:09.0846706Z def recv_into(self, buffer, nbytes=None, flags=0):
2021-05-22T00:06:09.0847200Z self._checkClosed()
2021-05-22T00:06:09.0847738Z if buffer and (nbytes is None):
2021-05-22T00:06:09.0848173Z nbytes = len(buffer)
2021-05-22T00:06:09.0848587Z elif nbytes is None:
2021-05-22T00:06:09.0848959Z nbytes = 1024
2021-05-22T00:06:09.0849330Z if self._sslobj:
2021-05-22T00:06:09.0849696Z if flags != 0:
2021-05-22T00:06:09.0850481Z raise ValueError("non-zero flags not allowed in calls to recv_into() on %s" % self.__class__)
2021-05-22T00:06:09.0851145Z > return self.read(nbytes, buffer)
2021-05-22T00:06:09.0851464Z
2021-05-22T00:06:09.0852214Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/gevent/_ssl3.py:567:
2021-05-22T00:06:09.0852850Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0853089Z
2021-05-22T00:06:09.0853980Z self = <gevent._ssl3.SSLSocket [closed] at 0x7f84f0f84450 server=False, cipher='' object [closed proxy at 0x7f8504ce9e30 fd=22 closed]>
2021-05-22T00:06:09.0854770Z nbytes = 8192, buffer = <memory at 0x7f85043542c0>
2021-05-22T00:06:09.0855068Z
2021-05-22T00:06:09.0855460Z def read(self, nbytes=2014, buffer=None):
2021-05-22T00:06:09.0855968Z """Read up to LEN bytes and return them.
2021-05-22T00:06:09.0856686Z Return zero-length string on EOF."""
2021-05-22T00:06:09.0857368Z # pylint:disable=too-many-branches
2021-05-22T00:06:09.0857864Z self._checkClosed()
2021-05-22T00:06:09.0858372Z # The stdlib signature is (len=1024, buffer=None)
2021-05-22T00:06:09.0858963Z # but that shadows the len builtin, and its hard/annoying to
2021-05-22T00:06:09.0859462Z # get it back.
2021-05-22T00:06:09.0859948Z initial_buf_len = len(buffer) if buffer is not None else None
2021-05-22T00:06:09.0860442Z while True:
2021-05-22T00:06:09.0860816Z if not self._sslobj:
2021-05-22T00:06:09.0861381Z raise ValueError("Read on closed or unwrapped SSL socket.")
2021-05-22T00:06:09.0861919Z if nbytes == 0:
2021-05-22T00:06:09.0862474Z return b'' if buffer is None else 0
2021-05-22T00:06:09.0863083Z # Negative lengths are handled natively when the buffer is None
2021-05-22T00:06:09.0863648Z # to raise a ValueError
2021-05-22T00:06:09.0864028Z try:
2021-05-22T00:06:09.0864384Z if buffer is not None:
2021-05-22T00:06:09.0864899Z return self._sslobj.read(nbytes, buffer)
2021-05-22T00:06:09.0865461Z return self._sslobj.read(nbytes or 1024)
2021-05-22T00:06:09.0866010Z except SSLWantReadError:
2021-05-22T00:06:09.0866540Z if self.timeout == 0.0:
2021-05-22T00:06:09.0866917Z raise
2021-05-22T00:06:09.0867494Z > self._wait(self._read_event, timeout_exc=_SSLErrorReadTimeout)
2021-05-22T00:06:09.0867946Z
2021-05-22T00:06:09.0868713Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/gevent/_ssl3.py:390:
2021-05-22T00:06:09.0869359Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0869599Z
2021-05-22T00:06:09.0869877Z > ???
2021-05-22T00:06:09.0870075Z
2021-05-22T00:06:09.0870456Z src/gevent/_hub_primitives.py:317:
2021-05-22T00:06:09.0870910Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0871158Z
2021-05-22T00:06:09.0871421Z > ???
2021-05-22T00:06:09.0871622Z
2021-05-22T00:06:09.0872002Z src/gevent/_hub_primitives.py:322:
2021-05-22T00:06:09.0872459Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0872708Z
2021-05-22T00:06:09.0872970Z > ???
2021-05-22T00:06:09.0873166Z
2021-05-22T00:06:09.0873562Z src/gevent/_hub_primitives.py:313:
2021-05-22T00:06:09.0874000Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0874248Z
2021-05-22T00:06:09.0874526Z > ???
2021-05-22T00:06:09.0874714Z
2021-05-22T00:06:09.0875176Z src/gevent/_hub_primitives.py:314:
2021-05-22T00:06:09.0875624Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0875881Z
2021-05-22T00:06:09.0876163Z > ???
2021-05-22T00:06:09.0876362Z
2021-05-22T00:06:09.0876738Z src/gevent/_hub_primitives.py:46:
2021-05-22T00:06:09.0877190Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0877440Z
2021-05-22T00:06:09.0877705Z > ???
2021-05-22T00:06:09.0877904Z
2021-05-22T00:06:09.0878288Z src/gevent/_hub_primitives.py:46:
2021-05-22T00:06:09.0878744Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0878994Z
2021-05-22T00:06:09.0879255Z > ???
2021-05-22T00:06:09.0879453Z
2021-05-22T00:06:09.0879849Z src/gevent/_hub_primitives.py:55:
2021-05-22T00:06:09.0880528Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0880781Z
2021-05-22T00:06:09.0881062Z > ???
2021-05-22T00:06:09.0881252Z
2021-05-22T00:06:09.0881608Z src/gevent/_waiter.py:154:
2021-05-22T00:06:09.0882010Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0882340Z
2021-05-22T00:06:09.0882614Z > ???
2021-05-22T00:06:09.0882811Z
2021-05-22T00:06:09.0883216Z src/gevent/_greenlet_primitives.py:61:
2021-05-22T00:06:09.0883693Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0883929Z
2021-05-22T00:06:09.0884208Z > ???
2021-05-22T00:06:09.0884408Z
2021-05-22T00:06:09.0884810Z src/gevent/_greenlet_primitives.py:61:
2021-05-22T00:06:09.0885294Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0885547Z
2021-05-22T00:06:09.0885816Z > ???
2021-05-22T00:06:09.0886013Z
2021-05-22T00:06:09.0886431Z src/gevent/_greenlet_primitives.py:65:
2021-05-22T00:06:09.0886903Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0887153Z
2021-05-22T00:06:09.0887414Z > ???
2021-05-22T00:06:09.0887874Z E socket.timeout: The read operation timed out
2021-05-22T00:06:09.0888246Z
2021-05-22T00:06:09.0888728Z src/gevent/_gevent_c_greenlet_primitives.pxd:35: timeout
2021-05-22T00:06:09.0889133Z
2021-05-22T00:06:09.0889666Z During handling of the above exception, another exception occurred:
2021-05-22T00:06:09.0890103Z
2021-05-22T00:06:09.0890712Z self = <requests.adapters.HTTPAdapter object at 0x7f84e2917650>
2021-05-22T00:06:09.0891506Z request = <PreparedRequest [GET]>, stream = False
2021-05-22T00:06:09.0892169Z timeout = Timeout(connect=5, read=30, total=None), verify = True, cert = None
2021-05-22T00:06:09.0892745Z proxies = OrderedDict()
2021-05-22T00:06:09.0893021Z
2021-05-22T00:06:09.0893590Z def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
2021-05-22T00:06:09.0894401Z """Sends PreparedRequest object. Returns Response object.
2021-05-22T00:06:09.0894918Z
2021-05-22T00:06:09.0895654Z :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
2021-05-22T00:06:09.0896458Z :param stream: (optional) Whether to stream the request content.
2021-05-22T00:06:09.0897160Z :param timeout: (optional) How long to wait for the server to send
2021-05-22T00:06:09.0897811Z data before giving up, as a float, or a :ref:`(connect timeout,
2021-05-22T00:06:09.0898394Z read timeout) <timeouts>` tuple.
2021-05-22T00:06:09.0898972Z :type timeout: float or tuple or urllib3 Timeout object
2021-05-22T00:06:09.0899664Z :param verify: (optional) Either a boolean, in which case it controls whether
2021-05-22T00:06:09.0900658Z we verify the server's TLS certificate, or a string, in which case it
2021-05-22T00:06:09.0901253Z must be a path to a CA bundle to use
2021-05-22T00:06:09.0902156Z :param cert: (optional) Any user-provided SSL certificate to be trusted.
2021-05-22T00:06:09.0902945Z :param proxies: (optional) The proxies dictionary to apply to the request.
2021-05-22T00:06:09.0903601Z :rtype: requests.Response
2021-05-22T00:06:09.0904015Z """
2021-05-22T00:06:09.0904294Z
2021-05-22T00:06:09.0904591Z try:
2021-05-22T00:06:09.0905075Z conn = self.get_connection(request.url, proxies)
2021-05-22T00:06:09.0905702Z except LocationValueError as e:
2021-05-22T00:06:09.0906278Z raise InvalidURL(e, request=request)
2021-05-22T00:06:09.0906701Z
2021-05-22T00:06:09.0907163Z self.cert_verify(conn, request.url, verify, cert)
2021-05-22T00:06:09.0907777Z url = self.request_url(request, proxies)
2021-05-22T00:06:09.0908554Z self.add_headers(request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
2021-05-22T00:06:09.0909185Z
2021-05-22T00:06:09.0909944Z chunked = not (request.body is None or 'Content-Length' in request.headers)
2021-05-22T00:06:09.0910511Z
2021-05-22T00:06:09.0910913Z if isinstance(timeout, tuple):
2021-05-22T00:06:09.0911309Z try:
2021-05-22T00:06:09.0911696Z connect, read = timeout
2021-05-22T00:06:09.0912336Z timeout = TimeoutSauce(connect=connect, read=read)
2021-05-22T00:06:09.0912906Z except ValueError as e:
2021-05-22T00:06:09.0913420Z # this may raise a string formatting error.
2021-05-22T00:06:09.0914007Z err = ("Invalid timeout {}. Pass a (connect, read) "
2021-05-22T00:06:09.0914576Z "timeout tuple, or a single float to set "
2021-05-22T00:06:09.0915170Z "both timeouts to the same value".format(timeout))
2021-05-22T00:06:09.0915711Z raise ValueError(err)
2021-05-22T00:06:09.0916233Z elif isinstance(timeout, TimeoutSauce):
2021-05-22T00:06:09.0916697Z pass
2021-05-22T00:06:09.0917010Z else:
2021-05-22T00:06:09.0917523Z timeout = TimeoutSauce(connect=timeout, read=timeout)
2021-05-22T00:06:09.0917989Z
2021-05-22T00:06:09.0918285Z try:
2021-05-22T00:06:09.0918624Z if not chunked:
2021-05-22T00:06:09.0919055Z resp = conn.urlopen(
2021-05-22T00:06:09.0919532Z method=request.method,
2021-05-22T00:06:09.0919970Z url=url,
2021-05-22T00:06:09.0920796Z body=request.body,
2021-05-22T00:06:09.0921290Z headers=request.headers,
2021-05-22T00:06:09.0921779Z redirect=False,
2021-05-22T00:06:09.0922205Z assert_same_host=False,
2021-05-22T00:06:09.0922672Z preload_content=False,
2021-05-22T00:06:09.0923130Z decode_content=False,
2021-05-22T00:06:09.0923607Z retries=self.max_retries,
2021-05-22T00:06:09.0924044Z > timeout=timeout
2021-05-22T00:06:09.0924408Z )
2021-05-22T00:06:09.0924623Z
2021-05-22T00:06:09.0925462Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/requests/adapters.py:449:
2021-05-22T00:06:09.0926143Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.0926399Z
2021-05-22T00:06:09.0927196Z self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.0928380Z method = 'GET', url = '/api/v1/validator/9/balancehistory', body = None
2021-05-22T00:06:09.0929469Z headers = {'User-Agent': 'rotkehlchen', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
2021-05-22T00:06:09.0930391Z retries = Retry(total=0, connect=None, read=False, redirect=None, status=None)
2021-05-22T00:06:09.0931039Z redirect = False, assert_same_host = False
2021-05-22T00:06:09.0931627Z timeout = Timeout(connect=5, read=30, total=None), pool_timeout = None
2021-05-22T00:06:09.0932285Z release_conn = False, chunked = False, body_pos = None
2021-05-22T00:06:09.0933193Z response_kw = {'decode_content': False, 'preload_content': False}
2021-05-22T00:06:09.0934314Z parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/api/v1/validator/9/balancehistory', query=None, fragment=None)
2021-05-22T00:06:09.0935211Z destination_scheme = None, conn = None, release_this_conn = True
2021-05-22T00:06:09.0935878Z http_tunnel_required = False, err = None, clean_exit = False
2021-05-22T00:06:09.0936256Z
2021-05-22T00:06:09.0936574Z def urlopen(
2021-05-22T00:06:09.0936927Z self,
2021-05-22T00:06:09.0937246Z method,
2021-05-22T00:06:09.0937573Z url,
2021-05-22T00:06:09.0937887Z body=None,
2021-05-22T00:06:09.0938251Z headers=None,
2021-05-22T00:06:09.0938618Z retries=None,
2021-05-22T00:06:09.0939007Z redirect=True,
2021-05-22T00:06:09.0939420Z assert_same_host=True,
2021-05-22T00:06:09.0939824Z timeout=_Default,
2021-05-22T00:06:09.0940235Z pool_timeout=None,
2021-05-22T00:06:09.0940641Z release_conn=None,
2021-05-22T00:06:09.0941043Z chunked=False,
2021-05-22T00:06:09.0941406Z body_pos=None,
2021-05-22T00:06:09.0941773Z **response_kw
2021-05-22T00:06:09.0942090Z ):
2021-05-22T00:06:09.0942461Z """
2021-05-22T00:06:09.0942973Z Get a connection from the pool and perform an HTTP request. This is the
2021-05-22T00:06:09.0943862Z lowest level call for making a request, so you'll need to specify all
2021-05-22T00:06:09.0944394Z the raw details.
2021-05-22T00:06:09.0944734Z
2021-05-22T00:06:09.0945231Z .. note::
2021-05-22T00:06:09.0945518Z
2021-05-22T00:06:09.0946226Z More commonly, it's appropriate to use a convenience method provided
2021-05-22T00:06:09.0946939Z by :class:`.RequestMethods`, such as :meth:`request`.
2021-05-22T00:06:09.0947401Z
2021-05-22T00:06:09.0947728Z .. note::
2021-05-22T00:06:09.0948036Z
2021-05-22T00:06:09.0948471Z `release_conn` will only behave as expected if
2021-05-22T00:06:09.0949062Z `preload_content=False` because we want to make
2021-05-22T00:06:09.0949716Z `preload_content=False` the default behaviour someday soon without
2021-05-22T00:06:09.0950378Z breaking backwards compatibility.
2021-05-22T00:06:09.0950803Z
2021-05-22T00:06:09.0951116Z :param method:
2021-05-22T00:06:09.0951614Z HTTP request method (such as GET, POST, PUT, etc.)
2021-05-22T00:06:09.0952033Z
2021-05-22T00:06:09.0952345Z :param url:
2021-05-22T00:06:09.0952787Z The URL to perform the request on.
2021-05-22T00:06:09.0953179Z
2021-05-22T00:06:09.0953479Z :param body:
2021-05-22T00:06:09.0954001Z Data to send in the request body, either :class:`str`, :class:`bytes`,
2021-05-22T00:06:09.0954839Z an iterable of :class:`str`/:class:`bytes`, or a file-like object.
2021-05-22T00:06:09.0955317Z
2021-05-22T00:06:09.0955654Z :param headers:
2021-05-22T00:06:09.0956341Z Dictionary of custom headers to send, such as User-Agent,
2021-05-22T00:06:09.0957219Z If-None-Match, etc. If None, pool headers are used. If provided,
2021-05-22T00:06:09.0958127Z these headers completely replace any pool-specific headers.
2021-05-22T00:06:09.0958655Z
2021-05-22T00:06:09.0958974Z :param retries:
2021-05-22T00:06:09.0959505Z Configure the number of retries to allow before raising a
2021-05-22T00:06:09.0960534Z :class:`~urllib3.exceptions.MaxRetryError` exception.
2021-05-22T00:06:09.0961167Z
2021-05-22T00:06:09.0961632Z Pass ``None`` to retry until you receive a response. Pass a
2021-05-22T00:06:09.0962577Z :class:`~urllib3.util.retry.Retry` object for fine-grained control
2021-05-22T00:06:09.0963280Z over different types of retries.
2021-05-22T00:06:09.0963902Z Pass an integer number to retry connection errors that many times,
2021-05-22T00:06:09.0964703Z but no other types of errors. Pass zero to never retry.
2021-05-22T00:06:09.0965148Z
2021-05-22T00:06:09.0965650Z If ``False``, then retries are disabled and any exception is raised
2021-05-22T00:06:09.0966404Z immediately. Also, instead of raising a MaxRetryError on redirects,
2021-05-22T00:06:09.0967099Z the redirect response will be returned.
2021-05-22T00:06:09.0967527Z
2021-05-22T00:06:09.0968085Z :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
2021-05-22T00:06:09.0968642Z
2021-05-22T00:06:09.0968973Z :param redirect:
2021-05-22T00:06:09.0969528Z If True, automatically handle redirects (status codes 301, 302,
2021-05-22T00:06:09.0970182Z 303, 307, 308). Each redirect counts as a retry. Disabling retries
2021-05-22T00:06:09.0970749Z will disable redirect, too.
2021-05-22T00:06:09.0971115Z
2021-05-22T00:06:09.0971471Z :param assert_same_host:
2021-05-22T00:06:09.0972005Z If ``True``, will make sure that the host of the pool requests is
2021-05-22T00:06:09.0972731Z consistent else will raise HostChangedError. When ``False``, you can
2021-05-22T00:06:09.0973541Z use the pool on an HTTP proxy and request foreign hosts.
2021-05-22T00:06:09.0973984Z
2021-05-22T00:06:09.0974317Z :param timeout:
2021-05-22T00:06:09.0974842Z If specified, overrides the default timeout for this one
2021-05-22T00:06:09.0975493Z request. It may be a float (in seconds) or an instance of
2021-05-22T00:06:09.0976082Z :class:`urllib3.util.Timeout`.
2021-05-22T00:06:09.0976507Z
2021-05-22T00:06:09.0976852Z :param pool_timeout:
2021-05-22T00:06:09.0977385Z If set and the pool is set to block=True, then this method will
2021-05-22T00:06:09.0978070Z block for ``pool_timeout`` seconds and raise EmptyPoolError if no
2021-05-22T00:06:09.0978739Z connection is available within the time period.
2021-05-22T00:06:09.0979194Z
2021-05-22T00:06:09.0979530Z :param release_conn:
2021-05-22T00:06:09.0980097Z If False, then the urlopen call will not release the connection
2021-05-22T00:06:09.0980797Z back into the pool once a response is received (but will release if
2021-05-22T00:06:09.0981481Z you read the entire contents of the response such as when
2021-05-22T00:06:09.0982327Z `preload_content=True`). This is useful if you're not preloading
2021-05-22T00:06:09.0983160Z the response's content immediately. You will need to call
2021-05-22T00:06:09.0983889Z ``r.release_conn()`` on the response ``r`` to return the connection
2021-05-22T00:06:09.0984507Z back into the pool. If None, it takes the value of
2021-05-22T00:06:09.0985219Z ``response_kw.get('preload_content', True)``.
2021-05-22T00:06:09.0985631Z
2021-05-22T00:06:09.0985968Z :param chunked:
2021-05-22T00:06:09.0986483Z If True, urllib3 will send the body using chunked transfer
2021-05-22T00:06:09.0987181Z encoding. Otherwise, urllib3 will send the body using the standard
2021-05-22T00:06:09.0987971Z content-length form. Defaults to False.
2021-05-22T00:06:09.0988414Z
2021-05-22T00:06:09.0988755Z :param int body_pos:
2021-05-22T00:06:09.0989442Z Position to seek to in file-like body in the event of a retry or
2021-05-22T00:06:09.0990303Z redirect. Typically this won't need to be set because urllib3 will
2021-05-22T00:06:09.0991071Z auto-populate the value when needed.
2021-05-22T00:06:09.0991501Z
2021-05-22T00:06:09.0991841Z :param \\**response_kw:
2021-05-22T00:06:09.0992338Z Additional parameters are passed to
2021-05-22T00:06:09.0993114Z :meth:`urllib3.response.HTTPResponse.from_httplib`
2021-05-22T00:06:09.0993755Z """
2021-05-22T00:06:09.0994029Z
2021-05-22T00:06:09.0994478Z parsed_url = parse_url(url)
2021-05-22T00:06:09.0995002Z destination_scheme = parsed_url.scheme
2021-05-22T00:06:09.0995418Z
2021-05-22T00:06:09.0995771Z if headers is None:
2021-05-22T00:06:09.0996201Z headers = self.headers
2021-05-22T00:06:09.0996574Z
2021-05-22T00:06:09.0996961Z if not isinstance(retries, Retry):
2021-05-22T00:06:09.0997660Z retries = Retry.from_int(retries, redirect=redirect, default=self.retries)
2021-05-22T00:06:09.0998216Z
2021-05-22T00:06:09.0998574Z if release_conn is None:
2021-05-22T00:06:09.0999108Z release_conn = response_kw.get("preload_content", True)
2021-05-22T00:06:09.0999571Z
2021-05-22T00:06:09.0999886Z # Check host
2021-05-22T00:06:09.1000436Z if assert_same_host and not self.is_same_host(url):
2021-05-22T00:06:09.1001048Z raise HostChangedError(self, url, retries)
2021-05-22T00:06:09.1001492Z
2021-05-22T00:06:09.1002159Z # Ensure that the URL we're connecting to is properly encoded
2021-05-22T00:06:09.1002716Z if url.startswith("/"):
2021-05-22T00:06:09.1003356Z url = six.ensure_str(_encode_target(url))
2021-05-22T00:06:09.1003882Z else:
2021-05-22T00:06:09.1004316Z url = six.ensure_str(parsed_url.url)
2021-05-22T00:06:09.1004709Z
2021-05-22T00:06:09.1005024Z conn = None
2021-05-22T00:06:09.1005323Z
2021-05-22T00:06:09.1005767Z # Track whether `conn` needs to be released before
2021-05-22T00:06:09.1006459Z # returning/raising/recursing. Update this variable if necessary, and
2021-05-22T00:06:09.1007211Z # leave `release_conn` constant throughout the function. That way, if
2021-05-22T00:06:09.1007943Z # the function recurses, the original value of `release_conn` will be
2021-05-22T00:06:09.1008670Z # passed down into the recursive call, and its value will be respected.
2021-05-22T00:06:09.1009186Z #
2021-05-22T00:06:09.1009545Z # See issue #651 [1] for details.
2021-05-22T00:06:09.1009915Z #
2021-05-22T00:06:09.1010410Z # [1] <https://github.com/urllib3/urllib3/issues/651>
2021-05-22T00:06:09.1011000Z release_this_conn = release_conn
2021-05-22T00:06:09.1011388Z
2021-05-22T00:06:09.1011859Z http_tunnel_required = connection_requires_http_tunnel(
2021-05-22T00:06:09.1012540Z self.proxy, self.proxy_config, destination_scheme
2021-05-22T00:06:09.1013013Z )
2021-05-22T00:06:09.1013293Z
2021-05-22T00:06:09.1013783Z # Merge the proxy headers. Only done when not using HTTP CONNECT. We
2021-05-22T00:06:09.1014494Z # have to copy the headers dict so we can safely change it without those
2021-05-22T00:06:09.1015295Z # changes being reflected in anyone else's copy.
2021-05-22T00:06:09.1015829Z if not http_tunnel_required:
2021-05-22T00:06:09.1016313Z headers = headers.copy()
2021-05-22T00:06:09.1016860Z headers.update(self.proxy_headers)
2021-05-22T00:06:09.1017299Z
2021-05-22T00:06:09.1017806Z # Must keep the exception bound to a separate variable or else Python 3
2021-05-22T00:06:09.1018491Z # complains about UnboundLocalError.
2021-05-22T00:06:09.1018966Z err = None
2021-05-22T00:06:09.1019275Z
2021-05-22T00:06:09.1019755Z # Keep track of whether we cleanly exited the except block. This
2021-05-22T00:06:09.1020388Z # ensures we do proper cleanup in finally.
2021-05-22T00:06:09.1020851Z clean_exit = False
2021-05-22T00:06:09.1021185Z
2021-05-22T00:06:09.1021672Z # Rewind body position, if needed. Record current position
2021-05-22T00:06:09.1022310Z # for future rewinds in the event of a redirect/retry.
2021-05-22T00:06:09.1022893Z body_pos = set_file_position(body, body_pos)
2021-05-22T00:06:09.1023293Z
2021-05-22T00:06:09.1023585Z try:
2021-05-22T00:06:09.1024001Z # Request a connection from the queue.
2021-05-22T00:06:09.1024638Z timeout_obj = self._get_timeout(timeout)
2021-05-22T00:06:09.1025184Z conn = self._get_conn(timeout=pool_timeout)
2021-05-22T00:06:09.1025606Z
2021-05-22T00:06:09.1026049Z conn.timeout = timeout_obj.connect_timeout
2021-05-22T00:06:09.1026494Z
2021-05-22T00:06:09.1026959Z is_new_proxy_conn = self.proxy is not None and not getattr(
2021-05-22T00:06:09.1027468Z conn, "sock", None
2021-05-22T00:06:09.1027812Z )
2021-05-22T00:06:09.1028238Z if is_new_proxy_conn and http_tunnel_required:
2021-05-22T00:06:09.1028762Z self._prepare_proxy(conn)
2021-05-22T00:06:09.1029118Z
2021-05-22T00:06:09.1029578Z # Make the request on the httplib connection object.
2021-05-22T00:06:09.1030165Z httplib_response = self._make_request(
2021-05-22T00:06:09.1030604Z conn,
2021-05-22T00:06:09.1030933Z method,
2021-05-22T00:06:09.1031275Z url,
2021-05-22T00:06:09.1031642Z timeout=timeout_obj,
2021-05-22T00:06:09.1032076Z body=body,
2021-05-22T00:06:09.1032471Z headers=headers,
2021-05-22T00:06:09.1032989Z chunked=chunked,
2021-05-22T00:06:09.1033345Z )
2021-05-22T00:06:09.1033624Z
2021-05-22T00:06:09.1034300Z # If we're going to release the connection in ``finally:``, then
2021-05-22T00:06:09.1035148Z # the response doesn't need to know about the connection. Otherwise
2021-05-22T00:06:09.1036020Z # it will also try to release it and we'll have a double-release
2021-05-22T00:06:09.1036518Z # mess.
2021-05-22T00:06:09.1036993Z response_conn = conn if not release_conn else None
2021-05-22T00:06:09.1037433Z
2021-05-22T00:06:09.1037860Z # Pass method to Response for length checking
2021-05-22T00:06:09.1038427Z response_kw["request_method"] = method
2021-05-22T00:06:09.1038836Z
2021-05-22T00:06:09.1039450Z # Import httplib's response into our own wrapper object
2021-05-22T00:06:09.1040216Z response = self.ResponseCls.from_httplib(
2021-05-22T00:06:09.1040803Z httplib_response,
2021-05-22T00:06:09.1041193Z pool=self,
2021-05-22T00:06:09.1041628Z connection=response_conn,
2021-05-22T00:06:09.1042079Z retries=retries,
2021-05-22T00:06:09.1042485Z **response_kw
2021-05-22T00:06:09.1042835Z )
2021-05-22T00:06:09.1043107Z
2021-05-22T00:06:09.1043478Z # Everything went great!
2021-05-22T00:06:09.1043893Z clean_exit = True
2021-05-22T00:06:09.1044228Z
2021-05-22T00:06:09.1044612Z except EmptyPoolError:
2021-05-22T00:06:09.1045353Z # Didn't get a connection from the pool, no need to clean up
2021-05-22T00:06:09.1045855Z clean_exit = True
2021-05-22T00:06:09.1046279Z release_this_conn = False
2021-05-22T00:06:09.1046652Z raise
2021-05-22T00:06:09.1046954Z
2021-05-22T00:06:09.1047256Z except (
2021-05-22T00:06:09.1047640Z TimeoutError,
2021-05-22T00:06:09.1048063Z HTTPException,
2021-05-22T00:06:09.1048491Z SocketError,
2021-05-22T00:06:09.1048913Z ProtocolError,
2021-05-22T00:06:09.1049331Z BaseSSLError,
2021-05-22T00:06:09.1049722Z SSLError,
2021-05-22T00:06:09.1050144Z CertificateError,
2021-05-22T00:06:09.1050545Z ) as e:
2021-05-22T00:06:09.1051044Z # Discard the connection for these exceptions. It will be
2021-05-22T00:06:09.1051662Z # replaced during the next _get_conn() call.
2021-05-22T00:06:09.1052119Z clean_exit = False
2021-05-22T00:06:09.1052703Z if isinstance(e, (BaseSSLError, CertificateError)):
2021-05-22T00:06:09.1053264Z e = SSLError(e)
2021-05-22T00:06:09.1054001Z elif isinstance(e, (SocketError, NewConnectionError)) and self.proxy:
2021-05-22T00:06:09.1054763Z e = ProxyError("Cannot connect to proxy.", e)
2021-05-22T00:06:09.1055404Z elif isinstance(e, (SocketError, HTTPException)):
2021-05-22T00:06:09.1056083Z e = ProtocolError("Connection aborted.", e)
2021-05-22T00:06:09.1056525Z
2021-05-22T00:06:09.1056952Z retries = retries.increment(
2021-05-22T00:06:09.1057564Z > method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
2021-05-22T00:06:09.1058059Z )
2021-05-22T00:06:09.1058268Z
2021-05-22T00:06:09.1059128Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/connectionpool.py:756:
2021-05-22T00:06:09.1059850Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1060108Z
2021-05-22T00:06:09.1060600Z self = Retry(total=0, connect=None, read=False, redirect=None, status=None)
2021-05-22T00:06:09.1061505Z method = 'GET', url = '/api/v1/validator/9/balancehistory', response = None
2021-05-22T00:06:09.1062634Z error = ReadTimeoutError("HTTPSConnectionPool(host='beaconcha.in', port=443): Read timed out. (read timeout=30)")
2021-05-22T00:06:09.1063959Z _pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.1064912Z _stacktrace = <traceback object at 0x7f85045595a0>
2021-05-22T00:06:09.1065241Z
2021-05-22T00:06:09.1065570Z def increment(
2021-05-22T00:06:09.1065913Z self,
2021-05-22T00:06:09.1066259Z method=None,
2021-05-22T00:06:09.1066598Z url=None,
2021-05-22T00:06:09.1066966Z response=None,
2021-05-22T00:06:09.1067348Z error=None,
2021-05-22T00:06:09.1067687Z _pool=None,
2021-05-22T00:06:09.1068074Z _stacktrace=None,
2021-05-22T00:06:09.1068414Z ):
2021-05-22T00:06:09.1068906Z """Return a new Retry object with incremented retry counters.
2021-05-22T00:06:09.1069377Z
2021-05-22T00:06:09.1069881Z :param response: A response object, or None, if the server did not
2021-05-22T00:06:09.1070438Z return a response.
2021-05-22T00:06:09.1071113Z :type response: :class:`~urllib3.response.HTTPResponse`
2021-05-22T00:06:09.1071944Z :param Exception error: An error encountered during the request, or
2021-05-22T00:06:09.1072653Z None if the response was received successfully.
2021-05-22T00:06:09.1073111Z
2021-05-22T00:06:09.1073470Z :return: A new ``Retry`` object.
2021-05-22T00:06:09.1073848Z """
2021-05-22T00:06:09.1074229Z if self.total is False and error:
2021-05-22T00:06:09.1074935Z # Disabled, indicate to re-raise the error.
2021-05-22T00:06:09.1075552Z raise six.reraise(type(error), error, _stacktrace)
2021-05-22T00:06:09.1076018Z
2021-05-22T00:06:09.1076348Z total = self.total
2021-05-22T00:06:09.1076745Z if total is not None:
2021-05-22T00:06:09.1077209Z total -= 1
2021-05-22T00:06:09.1077525Z
2021-05-22T00:06:09.1077882Z connect = self.connect
2021-05-22T00:06:09.1078303Z read = self.read
2021-05-22T00:06:09.1078851Z redirect = self.redirect
2021-05-22T00:06:09.1079316Z status_count = self.status
2021-05-22T00:06:09.1079758Z other = self.other
2021-05-22T00:06:09.1080240Z cause = "unknown"
2021-05-22T00:06:09.1080618Z status = None
2021-05-22T00:06:09.1081013Z redirect_location = None
2021-05-22T00:06:09.1081379Z
2021-05-22T00:06:09.1081802Z if error and self._is_connection_error(error):
2021-05-22T00:06:09.1082292Z # Connect retry?
2021-05-22T00:06:09.1082690Z if connect is False:
2021-05-22T00:06:09.1083239Z raise six.reraise(type(error), error, _stacktrace)
2021-05-22T00:06:09.1083797Z elif connect is not None:
2021-05-22T00:06:09.1084329Z connect -= 1
2021-05-22T00:06:09.1084653Z
2021-05-22T00:06:09.1085163Z elif error and self._is_read_error(error):
2021-05-22T00:06:09.1085624Z # Read retry?
2021-05-22T00:06:09.1086126Z if read is False or not self._is_method_retryable(method):
2021-05-22T00:06:09.1086775Z > raise six.reraise(type(error), error, _stacktrace)
2021-05-22T00:06:09.1087165Z
2021-05-22T00:06:09.1087952Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/util/retry.py:532:
2021-05-22T00:06:09.1088615Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1088871Z
2021-05-22T00:06:09.1089698Z tp = <class 'urllib3.exceptions.ReadTimeoutError'>, value = None, tb = None
2021-05-22T00:06:09.1090304Z
2021-05-22T00:06:09.1090667Z def reraise(tp, value, tb=None):
2021-05-22T00:06:09.1091058Z try:
2021-05-22T00:06:09.1091407Z if value is None:
2021-05-22T00:06:09.1091771Z value = tp()
2021-05-22T00:06:09.1092194Z if value.__traceback__ is not tb:
2021-05-22T00:06:09.1092685Z raise value.with_traceback(tb)
2021-05-22T00:06:09.1093125Z > raise value
2021-05-22T00:06:09.1093363Z
2021-05-22T00:06:09.1094150Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/packages/six.py:735:
2021-05-22T00:06:09.1094891Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1095130Z
2021-05-22T00:06:09.1095949Z self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.1097147Z method = 'GET', url = '/api/v1/validator/9/balancehistory', body = None
2021-05-22T00:06:09.1098226Z headers = {'User-Agent': 'rotkehlchen', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
2021-05-22T00:06:09.1099155Z retries = Retry(total=0, connect=None, read=False, redirect=None, status=None)
2021-05-22T00:06:09.1099791Z redirect = False, assert_same_host = False
2021-05-22T00:06:09.1100401Z timeout = Timeout(connect=5, read=30, total=None), pool_timeout = None
2021-05-22T00:06:09.1101018Z release_conn = False, chunked = False, body_pos = None
2021-05-22T00:06:09.1101802Z response_kw = {'decode_content': False, 'preload_content': False}
2021-05-22T00:06:09.1102905Z parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/api/v1/validator/9/balancehistory', query=None, fragment=None)
2021-05-22T00:06:09.1103783Z destination_scheme = None, conn = None, release_this_conn = True
2021-05-22T00:06:09.1104436Z http_tunnel_required = False, err = None, clean_exit = False
2021-05-22T00:06:09.1104815Z
2021-05-22T00:06:09.1105125Z def urlopen(
2021-05-22T00:06:09.1105466Z self,
2021-05-22T00:06:09.1105815Z method,
2021-05-22T00:06:09.1106122Z url,
2021-05-22T00:06:09.1106446Z body=None,
2021-05-22T00:06:09.1106794Z headers=None,
2021-05-22T00:06:09.1107171Z retries=None,
2021-05-22T00:06:09.1107541Z redirect=True,
2021-05-22T00:06:09.1107950Z assert_same_host=True,
2021-05-22T00:06:09.1108359Z timeout=_Default,
2021-05-22T00:06:09.1108764Z pool_timeout=None,
2021-05-22T00:06:09.1109160Z release_conn=None,
2021-05-22T00:06:09.1109551Z chunked=False,
2021-05-22T00:06:09.1109918Z body_pos=None,
2021-05-22T00:06:09.1110287Z **response_kw
2021-05-22T00:06:09.1110618Z ):
2021-05-22T00:06:09.1110894Z """
2021-05-22T00:06:09.1111411Z Get a connection from the pool and perform an HTTP request. This is the
2021-05-22T00:06:09.1112281Z lowest level call for making a request, so you'll need to specify all
2021-05-22T00:06:09.1112821Z the raw details.
2021-05-22T00:06:09.1113142Z
2021-05-22T00:06:09.1113588Z .. note::
2021-05-22T00:06:09.1113876Z
2021-05-22T00:06:09.1114574Z More commonly, it's appropriate to use a convenience method provided
2021-05-22T00:06:09.1115286Z by :class:`.RequestMethods`, such as :meth:`request`.
2021-05-22T00:06:09.1115748Z
2021-05-22T00:06:09.1116178Z .. note::
2021-05-22T00:06:09.1116475Z
2021-05-22T00:06:09.1116913Z `release_conn` will only behave as expected if
2021-05-22T00:06:09.1117490Z `preload_content=False` because we want to make
2021-05-22T00:06:09.1118156Z `preload_content=False` the default behaviour someday soon without
2021-05-22T00:06:09.1118806Z breaking backwards compatibility.
2021-05-22T00:06:09.1119228Z
2021-05-22T00:06:09.1119545Z :param method:
2021-05-22T00:06:09.1120037Z HTTP request method (such as GET, POST, PUT, etc.)
2021-05-22T00:06:09.1120562Z
2021-05-22T00:06:09.1120875Z :param url:
2021-05-22T00:06:09.1121294Z The URL to perform the request on.
2021-05-22T00:06:09.1121683Z
2021-05-22T00:06:09.1121998Z :param body:
2021-05-22T00:06:09.1122508Z Data to send in the request body, either :class:`str`, :class:`bytes`,
2021-05-22T00:06:09.1123379Z an iterable of :class:`str`/:class:`bytes`, or a file-like object.
2021-05-22T00:06:09.1123842Z
2021-05-22T00:06:09.1124180Z :param headers:
2021-05-22T00:06:09.1124869Z Dictionary of custom headers to send, such as User-Agent,
2021-05-22T00:06:09.1125849Z If-None-Match, etc. If None, pool headers are used. If provided,
2021-05-22T00:06:09.1126754Z these headers completely replace any pool-specific headers.
2021-05-22T00:06:09.1127284Z
2021-05-22T00:06:09.1127622Z :param retries:
2021-05-22T00:06:09.1128145Z Configure the number of retries to allow before raising a
2021-05-22T00:06:09.1128974Z :class:`~urllib3.exceptions.MaxRetryError` exception.
2021-05-22T00:06:09.1129592Z
2021-05-22T00:06:09.1130063Z Pass ``None`` to retry until you receive a response. Pass a
2021-05-22T00:06:09.1130981Z :class:`~urllib3.util.retry.Retry` object for fine-grained control
2021-05-22T00:06:09.1131700Z over different types of retries.
2021-05-22T00:06:09.1132346Z Pass an integer number to retry connection errors that many times,
2021-05-22T00:06:09.1133027Z but no other types of errors. Pass zero to never retry.
2021-05-22T00:06:09.1133483Z
2021-05-22T00:06:09.1133965Z If ``False``, then retries are disabled and any exception is raised
2021-05-22T00:06:09.1134724Z immediately. Also, instead of raising a MaxRetryError on redirects,
2021-05-22T00:06:09.1135407Z the redirect response will be returned.
2021-05-22T00:06:09.1135830Z
2021-05-22T00:06:09.1136382Z :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
2021-05-22T00:06:09.1136952Z
2021-05-22T00:06:09.1137285Z :param redirect:
2021-05-22T00:06:09.1137840Z If True, automatically handle redirects (status codes 301, 302,
2021-05-22T00:06:09.1138510Z 303, 307, 308). Each redirect counts as a retry. Disabling retries
2021-05-22T00:06:09.1139066Z will disable redirect, too.
2021-05-22T00:06:09.1139446Z
2021-05-22T00:06:09.1139790Z :param assert_same_host:
2021-05-22T00:06:09.1140332Z If ``True``, will make sure that the host of the pool requests is
2021-05-22T00:06:09.1141047Z consistent else will raise HostChangedError. When ``False``, you can
2021-05-22T00:06:09.1141770Z use the pool on an HTTP proxy and request foreign hosts.
2021-05-22T00:06:09.1142213Z
2021-05-22T00:06:09.1142545Z :param timeout:
2021-05-22T00:06:09.1143071Z If specified, overrides the default timeout for this one
2021-05-22T00:06:09.1143733Z request. It may be a float (in seconds) or an instance of
2021-05-22T00:06:09.1144332Z :class:`urllib3.util.Timeout`.
2021-05-22T00:06:09.1144742Z
2021-05-22T00:06:09.1145095Z :param pool_timeout:
2021-05-22T00:06:09.1145613Z If set and the pool is set to block=True, then this method will
2021-05-22T00:06:09.1146381Z block for ``pool_timeout`` seconds and raise EmptyPoolError if no
2021-05-22T00:06:09.1147057Z connection is available within the time period.
2021-05-22T00:06:09.1147509Z
2021-05-22T00:06:09.1147850Z :param release_conn:
2021-05-22T00:06:09.1148414Z If False, then the urlopen call will not release the connection
2021-05-22T00:06:09.1149119Z back into the pool once a response is received (but will release if
2021-05-22T00:06:09.1149789Z you read the entire contents of the response such as when
2021-05-22T00:06:09.1150646Z `preload_content=True`). This is useful if you're not preloading
2021-05-22T00:06:09.1151465Z the response's content immediately. You will need to call
2021-05-22T00:06:09.1152159Z ``r.release_conn()`` on the response ``r`` to return the connection
2021-05-22T00:06:09.1152782Z back into the pool. If None, it takes the value of
2021-05-22T00:06:09.1153497Z ``response_kw.get('preload_content', True)``.
2021-05-22T00:06:09.1153919Z
2021-05-22T00:06:09.1154241Z :param chunked:
2021-05-22T00:06:09.1154761Z If True, urllib3 will send the body using chunked transfer
2021-05-22T00:06:09.1155550Z encoding. Otherwise, urllib3 will send the body using the standard
2021-05-22T00:06:09.1156367Z content-length form. Defaults to False.
2021-05-22T00:06:09.1156796Z
2021-05-22T00:06:09.1157135Z :param int body_pos:
2021-05-22T00:06:09.1157824Z Position to seek to in file-like body in the event of a retry or
2021-05-22T00:06:09.1158686Z redirect. Typically this won't need to be set because urllib3 will
2021-05-22T00:06:09.1159459Z auto-populate the value when needed.
2021-05-22T00:06:09.1159889Z
2021-05-22T00:06:09.1160341Z :param \\**response_kw:
2021-05-22T00:06:09.1160830Z Additional parameters are passed to
2021-05-22T00:06:09.1161625Z :meth:`urllib3.response.HTTPResponse.from_httplib`
2021-05-22T00:06:09.1162258Z """
2021-05-22T00:06:09.1162548Z
2021-05-22T00:06:09.1162897Z parsed_url = parse_url(url)
2021-05-22T00:06:09.1163410Z destination_scheme = parsed_url.scheme
2021-05-22T00:06:09.1163829Z
2021-05-22T00:06:09.1164174Z if headers is None:
2021-05-22T00:06:09.1164601Z headers = self.headers
2021-05-22T00:06:09.1164976Z
2021-05-22T00:06:09.1165367Z if not isinstance(retries, Retry):
2021-05-22T00:06:09.1166069Z retries = Retry.from_int(retries, redirect=redirect, default=self.retries)
2021-05-22T00:06:09.1166637Z
2021-05-22T00:06:09.1166981Z if release_conn is None:
2021-05-22T00:06:09.1167529Z release_conn = response_kw.get("preload_content", True)
2021-05-22T00:06:09.1167982Z
2021-05-22T00:06:09.1168296Z # Check host
2021-05-22T00:06:09.1168746Z if assert_same_host and not self.is_same_host(url):
2021-05-22T00:06:09.1169362Z raise HostChangedError(self, url, retries)
2021-05-22T00:06:09.1169815Z
2021-05-22T00:06:09.1170459Z # Ensure that the URL we're connecting to is properly encoded
2021-05-22T00:06:09.1171026Z if url.startswith("/"):
2021-05-22T00:06:09.1171515Z url = six.ensure_str(_encode_target(url))
2021-05-22T00:06:09.1171949Z else:
2021-05-22T00:06:09.1172367Z url = six.ensure_str(parsed_url.url)
2021-05-22T00:06:09.1172767Z
2021-05-22T00:06:09.1173063Z conn = None
2021-05-22T00:06:09.1173369Z
2021-05-22T00:06:09.1173800Z # Track whether `conn` needs to be released before
2021-05-22T00:06:09.1174498Z # returning/raising/recursing. Update this variable if necessary, and
2021-05-22T00:06:09.1175246Z # leave `release_conn` constant throughout the function. That way, if
2021-05-22T00:06:09.1175974Z # the function recurses, the original value of `release_conn` will be
2021-05-22T00:06:09.1176789Z # passed down into the recursive call, and its value will be respected.
2021-05-22T00:06:09.1177294Z #
2021-05-22T00:06:09.1177662Z # See issue #651 [1] for details.
2021-05-22T00:06:09.1178017Z #
2021-05-22T00:06:09.1178524Z # [1] <https://github.com/urllib3/urllib3/issues/651>
2021-05-22T00:06:09.1179102Z release_this_conn = release_conn
2021-05-22T00:06:09.1179487Z
2021-05-22T00:06:09.1179960Z http_tunnel_required = connection_requires_http_tunnel(
2021-05-22T00:06:09.1180649Z self.proxy, self.proxy_config, destination_scheme
2021-05-22T00:06:09.1181121Z )
2021-05-22T00:06:09.1181405Z
2021-05-22T00:06:09.1181904Z # Merge the proxy headers. Only done when not using HTTP CONNECT. We
2021-05-22T00:06:09.1182602Z # have to copy the headers dict so we can safely change it without those
2021-05-22T00:06:09.1183412Z # changes being reflected in anyone else's copy.
2021-05-22T00:06:09.1183937Z if not http_tunnel_required:
2021-05-22T00:06:09.1184417Z headers = headers.copy()
2021-05-22T00:06:09.1184953Z headers.update(self.proxy_headers)
2021-05-22T00:06:09.1185395Z
2021-05-22T00:06:09.1185982Z # Must keep the exception bound to a separate variable or else Python 3
2021-05-22T00:06:09.1186664Z # complains about UnboundLocalError.
2021-05-22T00:06:09.1187138Z err = None
2021-05-22T00:06:09.1187436Z
2021-05-22T00:06:09.1187938Z # Keep track of whether we cleanly exited the except block. This
2021-05-22T00:06:09.1188562Z # ensures we do proper cleanup in finally.
2021-05-22T00:06:09.1189049Z clean_exit = False
2021-05-22T00:06:09.1189367Z
2021-05-22T00:06:09.1189853Z # Rewind body position, if needed. Record current position
2021-05-22T00:06:09.1190494Z # for future rewinds in the event of a redirect/retry.
2021-05-22T00:06:09.1191077Z body_pos = set_file_position(body, body_pos)
2021-05-22T00:06:09.1191477Z
2021-05-22T00:06:09.1191770Z try:
2021-05-22T00:06:09.1192187Z # Request a connection from the queue.
2021-05-22T00:06:09.1192740Z timeout_obj = self._get_timeout(timeout)
2021-05-22T00:06:09.1193295Z conn = self._get_conn(timeout=pool_timeout)
2021-05-22T00:06:09.1193697Z
2021-05-22T00:06:09.1194145Z conn.timeout = timeout_obj.connect_timeout
2021-05-22T00:06:09.1194570Z
2021-05-22T00:06:09.1195034Z is_new_proxy_conn = self.proxy is not None and not getattr(
2021-05-22T00:06:09.1195541Z conn, "sock", None
2021-05-22T00:06:09.1195885Z )
2021-05-22T00:06:09.1196310Z if is_new_proxy_conn and http_tunnel_required:
2021-05-22T00:06:09.1196833Z self._prepare_proxy(conn)
2021-05-22T00:06:09.1197194Z
2021-05-22T00:06:09.1197663Z # Make the request on the httplib connection object.
2021-05-22T00:06:09.1198259Z httplib_response = self._make_request(
2021-05-22T00:06:09.1198690Z conn,
2021-05-22T00:06:09.1199030Z method,
2021-05-22T00:06:09.1199353Z url,
2021-05-22T00:06:09.1199733Z timeout=timeout_obj,
2021-05-22T00:06:09.1200421Z body=body,
2021-05-22T00:06:09.1200821Z headers=headers,
2021-05-22T00:06:09.1201223Z > chunked=chunked,
2021-05-22T00:06:09.1201577Z )
2021-05-22T00:06:09.1201783Z
2021-05-22T00:06:09.1202677Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/connectionpool.py:706:
2021-05-22T00:06:09.1203401Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1203652Z
2021-05-22T00:06:09.1204454Z self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.1205648Z conn = <urllib3.connection.HTTPSConnection object at 0x7f8504a99850>
2021-05-22T00:06:09.1206708Z method = 'GET', url = '/api/v1/validator/9/balancehistory'
2021-05-22T00:06:09.1207363Z timeout = Timeout(connect=5, read=30, total=None), chunked = False
2021-05-22T00:06:09.1208549Z httplib_request_kw = {'body': None, 'headers': {'User-Agent': 'rotkehlchen', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}}
2021-05-22T00:06:09.1209526Z timeout_obj = Timeout(connect=5, read=30, total=None), read_timeout = 30
2021-05-22T00:06:09.1209917Z
2021-05-22T00:06:09.1210237Z def _make_request(
2021-05-22T00:06:09.1210832Z self, conn, method, url, timeout=_Default, chunked=False, **httplib_request_kw
2021-05-22T00:06:09.1211364Z ):
2021-05-22T00:06:09.1211637Z """
2021-05-22T00:06:09.1212152Z Perform a request on a given urllib connection object taken from our
2021-05-22T00:06:09.1212667Z pool.
2021-05-22T00:06:09.1212967Z
2021-05-22T00:06:09.1213272Z :param conn:
2021-05-22T00:06:09.1213750Z a connection from one of our connection pools
2021-05-22T00:06:09.1214168Z
2021-05-22T00:06:09.1214505Z :param timeout:
2021-05-22T00:06:09.1215011Z Socket timeout in seconds for the request. This can be a
2021-05-22T00:06:09.1215658Z float or integer, which will set the same timeout value for
2021-05-22T00:06:09.1216375Z the socket connect and the socket read, or an instance of
2021-05-22T00:06:09.1217263Z :class:`urllib3.util.Timeout`, which gives you more fine-grained
2021-05-22T00:06:09.1217899Z control over your timeouts.
2021-05-22T00:06:09.1218269Z """
2021-05-22T00:06:09.1218632Z self.num_requests += 1
2021-05-22T00:06:09.1218977Z
2021-05-22T00:06:09.1219386Z timeout_obj = self._get_timeout(timeout)
2021-05-22T00:06:09.1219884Z timeout_obj.start_connect()
2021-05-22T00:06:09.1220427Z conn.timeout = timeout_obj.connect_timeout
2021-05-22T00:06:09.1220855Z
2021-05-22T00:06:09.1221284Z # Trigger any extra validation we need to do.
2021-05-22T00:06:09.1221721Z try:
2021-05-22T00:06:09.1222092Z self._validate_conn(conn)
2021-05-22T00:06:09.1222647Z except (SocketTimeout, BaseSSLError) as e:
2021-05-22T00:06:09.1223340Z # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
2021-05-22T00:06:09.1224072Z self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
2021-05-22T00:06:09.1224584Z raise
2021-05-22T00:06:09.1224886Z
2021-05-22T00:06:09.1225377Z # conn.request() calls http.client.*.request, not the method in
2021-05-22T00:06:09.1226096Z # urllib3.request. It also calls makefile (recv) on the socket.
2021-05-22T00:06:09.1226592Z try:
2021-05-22T00:06:09.1226935Z if chunked:
2021-05-22T00:06:09.1227465Z conn.request_chunked(method, url, **httplib_request_kw)
2021-05-22T00:06:09.1227950Z else:
2021-05-22T00:06:09.1228433Z conn.request(method, url, **httplib_request_kw)
2021-05-22T00:06:09.1228877Z
2021-05-22T00:06:09.1229445Z # We are swallowing BrokenPipeError (errno.EPIPE) since the server is
2021-05-22T00:06:09.1230256Z # legitimately able to close the connection after sending a valid response.
2021-05-22T00:06:09.1231026Z # With this behaviour, the received response is still readable.
2021-05-22T00:06:09.1231640Z except BrokenPipeError:
2021-05-22T00:06:09.1232127Z # Python 3
2021-05-22T00:06:09.1232463Z pass
2021-05-22T00:06:09.1232824Z except IOError as e:
2021-05-22T00:06:09.1233256Z # Python 2 and macOS/Linux
2021-05-22T00:06:09.1233934Z # EPIPE and ESHUTDOWN are BrokenPipeError on Python 2, and EPROTOTYPE is needed on macOS
2021-05-22T00:06:09.1235585Z # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
2021-05-22T00:06:09.1236723Z if e.errno not in {
2021-05-22T00:06:09.1237144Z errno.EPIPE,
2021-05-22T00:06:09.1237659Z errno.ESHUTDOWN,
2021-05-22T00:06:09.1238144Z errno.EPROTOTYPE,
2021-05-22T00:06:09.1238525Z }:
2021-05-22T00:06:09.1238842Z raise
2021-05-22T00:06:09.1239151Z
2021-05-22T00:06:09.1239558Z # Reset the timeout for the recv() on the socket
2021-05-22T00:06:09.1240209Z read_timeout = timeout_obj.read_timeout
2021-05-22T00:06:09.1240611Z
2021-05-22T00:06:09.1241155Z # App Engine doesn't have a sock attr
2021-05-22T00:06:09.1241618Z if getattr(conn, "sock", None):
2021-05-22T00:06:09.1242197Z # In Python 3 socket.py will catch EAGAIN and return None when you
2021-05-22T00:06:09.1242895Z # try and read into the file pointer created by http.client, which
2021-05-22T00:06:09.1243647Z # instead raises a BadStatusLine exception. Instead of catching
2021-05-22T00:06:09.1244431Z # the exception and assuming all BadStatusLine exceptions are read
2021-05-22T00:06:09.1245167Z # timeouts, check for a zero timeout before making the request.
2021-05-22T00:06:09.1245712Z if read_timeout == 0:
2021-05-22T00:06:09.1246166Z raise ReadTimeoutError(
2021-05-22T00:06:09.1246842Z self, url, "Read timed out. (read timeout=%s)" % read_timeout
2021-05-22T00:06:09.1247299Z )
2021-05-22T00:06:09.1247765Z if read_timeout is Timeout.DEFAULT_TIMEOUT:
2021-05-22T00:06:09.1248514Z conn.sock.settimeout(socket.getdefaulttimeout())
2021-05-22T00:06:09.1249164Z else: # None or a value
2021-05-22T00:06:09.1249695Z conn.sock.settimeout(read_timeout)
2021-05-22T00:06:09.1250135Z
2021-05-22T00:06:09.1250547Z # Receive the response from the server
2021-05-22T00:06:09.1250957Z try:
2021-05-22T00:06:09.1251265Z try:
2021-05-22T00:06:09.1251711Z # Python 2.7, use buffering of HTTP responses
2021-05-22T00:06:09.1252379Z httplib_response = conn.getresponse(buffering=True)
2021-05-22T00:06:09.1252950Z except TypeError:
2021-05-22T00:06:09.1253359Z # Python 3
2021-05-22T00:06:09.1253685Z try:
2021-05-22T00:06:09.1254171Z httplib_response = conn.getresponse()
2021-05-22T00:06:09.1254754Z except BaseException as e:
2021-05-22T00:06:09.1255337Z # Remove the TypeError from the exception chain in
2021-05-22T00:06:09.1256009Z # Python 3 (including for exceptions like SystemExit).
2021-05-22T00:06:09.1256620Z # Otherwise it looks like a bug in the code.
2021-05-22T00:06:09.1257126Z six.raise_from(e, None)
2021-05-22T00:06:09.1257728Z except (SocketTimeout, BaseSSLError, SocketError) as e:
2021-05-22T00:06:09.1258453Z > self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
2021-05-22T00:06:09.1258854Z
2021-05-22T00:06:09.1259730Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/connectionpool.py:447:
2021-05-22T00:06:09.1260447Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1260700Z
2021-05-22T00:06:09.1261500Z self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f850e17dcd0>
2021-05-22T00:06:09.1262580Z err = timeout('The read operation timed out')
2021-05-22T00:06:09.1263330Z url = '/api/v1/validator/9/balancehistory', timeout_value = 30
2021-05-22T00:06:09.1263720Z
2021-05-22T00:06:09.1264152Z def _raise_timeout(self, err, url, timeout_value):
2021-05-22T00:06:09.1264793Z """Is the error actually a timeout? Will raise a ReadTimeout or pass"""
2021-05-22T00:06:09.1265288Z
2021-05-22T00:06:09.1265695Z if isinstance(err, SocketTimeout):
2021-05-22T00:06:09.1266240Z raise ReadTimeoutError(
2021-05-22T00:06:09.1266810Z > self, url, "Read timed out. (read timeout=%s)" % timeout_value
2021-05-22T00:06:09.1267348Z )
2021-05-22T00:06:09.1268518Z E urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='beaconcha.in', port=443): Read timed out. (read timeout=30)
2021-05-22T00:06:09.1269344Z
2021-05-22T00:06:09.1270297Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/urllib3/connectionpool.py:337: ReadTimeoutError
2021-05-22T00:06:09.1270961Z
2021-05-22T00:06:09.1271474Z During handling of the above exception, another exception occurred:
2021-05-22T00:06:09.1271916Z
2021-05-22T00:06:09.1272865Z self = <rotkehlchen.externalapis.beaconchain.BeaconChain object at 0x7f850e4b0350>
2021-05-22T00:06:09.1274180Z module = 'validator', endpoint = 'balancehistory', encoded_args = '9'
2021-05-22T00:06:09.1274605Z
2021-05-22T00:06:09.1274911Z def _query(
2021-05-22T00:06:09.1275232Z self,
2021-05-22T00:06:09.1275761Z module: Literal['validator'],
2021-05-22T00:06:09.1276515Z endpoint: Literal['balancehistory', 'performance', 'eth1'],
2021-05-22T00:06:09.1277093Z encoded_args: str,
2021-05-22T00:06:09.1277669Z ) -> Union[List[Dict[str, Any]], Dict[str, Any]]:
2021-05-22T00:06:09.1278067Z """
2021-05-22T00:06:09.1278372Z May raise:
2021-05-22T00:06:09.1279126Z - RemoteError due to problems querying beaconcha.in API
2021-05-22T00:06:09.1279628Z """
2021-05-22T00:06:09.1280091Z if endpoint == 'eth1':
2021-05-22T00:06:09.1280888Z query_str = f'{self.url}{module}/{endpoint}/{encoded_args}'
2021-05-22T00:06:09.1281364Z else:
2021-05-22T00:06:09.1281999Z query_str = f'{self.url}{module}/{encoded_args}/{endpoint}'
2021-05-22T00:06:09.1282526Z api_key = self._get_api_key()
2021-05-22T00:06:09.1282946Z if api_key is not None:
2021-05-22T00:06:09.1283495Z query_str += f'?apikey={api_key}'
2021-05-22T00:06:09.1283946Z times = QUERY_RETRY_TIMES
2021-05-22T00:06:09.1284356Z backoff_in_seconds = 10
2021-05-22T00:06:09.1284713Z
2021-05-22T00:06:09.1285358Z logger.debug(f'Querying beaconcha.in API for {query_str}')
2021-05-22T00:06:09.1285879Z while True:
2021-05-22T00:06:09.1286213Z try:
2021-05-22T00:06:09.1286774Z > response = self.session.get(query_str, timeout=DEFAULT_TIMEOUT_TUPLE)
2021-05-22T00:06:09.1287239Z
2021-05-22T00:06:09.1287715Z rotkehlchen/externalapis/beaconchain.py:68:
2021-05-22T00:06:09.1288231Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1288484Z
2021-05-22T00:06:09.1289025Z self = <requests.sessions.Session object at 0x7f850e4b0bd0>
2021-05-22T00:06:09.1290016Z url = 'https://beaconcha.in/api/v1/validator/9/balancehistory'
2021-05-22T00:06:09.1290849Z kwargs = {'allow_redirects': True, 'timeout': (5, 30)}
2021-05-22T00:06:09.1291169Z
2021-05-22T00:06:09.1291521Z def get(self, url, **kwargs):
2021-05-22T00:06:09.1292057Z r"""Sends a GET request. Returns :class:`Response` object.
2021-05-22T00:06:09.1292529Z
2021-05-22T00:06:09.1292963Z :param url: URL for the new :class:`Request` object.
2021-05-22T00:06:09.1293583Z :param \*\*kwargs: Optional arguments that ``request`` takes.
2021-05-22T00:06:09.1294188Z :rtype: requests.Response
2021-05-22T00:06:09.1294585Z """
2021-05-22T00:06:09.1294868Z
2021-05-22T00:06:09.1295454Z kwargs.setdefault('allow_redirects', True)
2021-05-22T00:06:09.1296175Z > return self.request('GET', url, **kwargs)
2021-05-22T00:06:09.1296509Z
2021-05-22T00:06:09.1297284Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/requests/sessions.py:555:
2021-05-22T00:06:09.1297952Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1298204Z
2021-05-22T00:06:09.1298933Z self = <requests.sessions.Session object at 0x7f850e4b0bd0>, method = 'GET'
2021-05-22T00:06:09.1299997Z url = 'https://beaconcha.in/api/v1/validator/9/balancehistory', params = None
2021-05-22T00:06:09.1300862Z data = None, headers = None, cookies = None, files = None, auth = None
2021-05-22T00:06:09.1301523Z timeout = (5, 30), allow_redirects = True, proxies = {}, hooks = None
2021-05-22T00:06:09.1302108Z stream = None, verify = None, cert = None, json = None
2021-05-22T00:06:09.1302448Z
2021-05-22T00:06:09.1302822Z def request(self, method, url,
2021-05-22T00:06:09.1303404Z params=None, data=None, headers=None, cookies=None, files=None,
2021-05-22T00:06:09.1304098Z auth=None, timeout=None, allow_redirects=True, proxies=None,
2021-05-22T00:06:09.1304762Z hooks=None, stream=None, verify=None, cert=None, json=None):
2021-05-22T00:06:09.1305448Z """Constructs a :class:`Request <Request>`, prepares it and sends it.
2021-05-22T00:06:09.1306104Z Returns :class:`Response <Response>` object.
2021-05-22T00:06:09.1306523Z
2021-05-22T00:06:09.1306991Z :param method: method for the new :class:`Request` object.
2021-05-22T00:06:09.1307597Z :param url: URL for the new :class:`Request` object.
2021-05-22T00:06:09.1308247Z :param params: (optional) Dictionary or bytes to be sent in the query
2021-05-22T00:06:09.1308833Z string for the :class:`Request`.
2021-05-22T00:06:09.1309698Z :param data: (optional) Dictionary, list of tuples, bytes, or file-like
2021-05-22T00:06:09.1310369Z object to send in the body of the :class:`Request`.
2021-05-22T00:06:09.1310937Z :param json: (optional) json to send in the body of the
2021-05-22T00:06:09.1311426Z :class:`Request`.
2021-05-22T00:06:09.1311990Z :param headers: (optional) Dictionary of HTTP Headers to send with the
2021-05-22T00:06:09.1312556Z :class:`Request`.
2021-05-22T00:06:09.1313103Z :param cookies: (optional) Dict or CookieJar object to send with the
2021-05-22T00:06:09.1313651Z :class:`Request`.
2021-05-22T00:06:09.1314414Z :param files: (optional) Dictionary of ``'filename': file-like-objects``
2021-05-22T00:06:09.1315084Z for multipart encoding upload.
2021-05-22T00:06:09.1315667Z :param auth: (optional) Auth tuple or callable to enable
2021-05-22T00:06:09.1316218Z Basic/Digest/Custom HTTP Auth.
2021-05-22T00:06:09.1316796Z :param timeout: (optional) How long to wait for the server to send
2021-05-22T00:06:09.1317453Z data before giving up, as a float, or a :ref:`(connect timeout,
2021-05-22T00:06:09.1318036Z read timeout) <timeouts>` tuple.
2021-05-22T00:06:09.1318505Z :type timeout: float or tuple
2021-05-22T00:06:09.1319067Z :param allow_redirects: (optional) Set to True by default.
2021-05-22T00:06:09.1319608Z :type allow_redirects: bool
2021-05-22T00:06:09.1320338Z :param proxies: (optional) Dictionary mapping protocol or protocol and
2021-05-22T00:06:09.1320977Z hostname to the URL of the proxy.
2021-05-22T00:06:09.1321611Z :param stream: (optional) whether to immediately download the response
2021-05-22T00:06:09.1322244Z content. Defaults to ``False``.
2021-05-22T00:06:09.1322887Z :param verify: (optional) Either a boolean, in which case it controls whether we verify
2021-05-22T00:06:09.1323869Z the server's TLS certificate, or a string, in which case it must be a path
2021-05-22T00:06:09.1324525Z to a CA bundle to use. Defaults to ``True``. When set to
2021-05-22T00:06:09.1325188Z ``False``, requests will accept any TLS certificate presented by
2021-05-22T00:06:09.1325910Z the server, and will ignore hostname mismatches and/or expired
2021-05-22T00:06:09.1326627Z certificates, which will make your application vulnerable to
2021-05-22T00:06:09.1327533Z man-in-the-middle (MitM) attacks. Setting verify to ``False``
2021-05-22T00:06:09.1328214Z may be useful during local development or testing.
2021-05-22T00:06:09.1328960Z :param cert: (optional) if String, path to ssl client cert file (.pem).
2021-05-22T00:06:09.1329663Z If Tuple, ('cert', 'key') pair.
2021-05-22T00:06:09.1330160Z :rtype: requests.Response
2021-05-22T00:06:09.1330556Z """
2021-05-22T00:06:09.1330919Z # Create the Request.
2021-05-22T00:06:09.1331317Z req = Request(
2021-05-22T00:06:09.1331732Z method=method.upper(),
2021-05-22T00:06:09.1332160Z url=url,
2021-05-22T00:06:09.1332523Z headers=headers,
2021-05-22T00:06:09.1332918Z files=files,
2021-05-22T00:06:09.1333271Z data=data or {},
2021-05-22T00:06:09.1333623Z json=json,
2021-05-22T00:06:09.1333993Z params=params or {},
2021-05-22T00:06:09.1334367Z auth=auth,
2021-05-22T00:06:09.1334732Z cookies=cookies,
2021-05-22T00:06:09.1335117Z hooks=hooks,
2021-05-22T00:06:09.1335431Z )
2021-05-22T00:06:09.1335842Z prep = self.prepare_request(req)
2021-05-22T00:06:09.1336248Z
2021-05-22T00:06:09.1336590Z proxies = proxies or {}
2021-05-22T00:06:09.1336940Z
2021-05-22T00:06:09.1337383Z settings = self.merge_environment_settings(
2021-05-22T00:06:09.1337985Z prep.url, proxies, stream, verify, cert
2021-05-22T00:06:09.1338480Z )
2021-05-22T00:06:09.1338765Z
2021-05-22T00:06:09.1339091Z # Send the request.
2021-05-22T00:06:09.1339475Z send_kwargs = {
2021-05-22T00:06:09.1339988Z 'timeout': timeout,
2021-05-22T00:06:09.1340595Z 'allow_redirects': allow_redirects,
2021-05-22T00:06:09.1340996Z }
2021-05-22T00:06:09.1341397Z send_kwargs.update(settings)
2021-05-22T00:06:09.1341916Z > resp = self.send(prep, **send_kwargs)
2021-05-22T00:06:09.1342224Z
2021-05-22T00:06:09.1343019Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/requests/sessions.py:542:
2021-05-22T00:06:09.1343677Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1343933Z
2021-05-22T00:06:09.1344489Z self = <requests.sessions.Session object at 0x7f850e4b0bd0>
2021-05-22T00:06:09.1345163Z request = <PreparedRequest [GET]>
2021-05-22T00:06:09.1345995Z kwargs = {'cert': None, 'proxies': OrderedDict(), 'stream': False, 'timeout': (5, 30), ...}
2021-05-22T00:06:09.1346837Z allow_redirects = True, stream = False, hooks = {'response': []}
2021-05-22T00:06:09.1347641Z adapter = <requests.adapters.HTTPAdapter object at 0x7f84e2917650>
2021-05-22T00:06:09.1348289Z start = 1621641764.0894969
2021-05-22T00:06:09.1348503Z
2021-05-22T00:06:09.1348883Z def send(self, request, **kwargs):
2021-05-22T00:06:09.1349409Z """Send a given PreparedRequest.
2021-05-22T00:06:09.1349817Z
2021-05-22T00:06:09.1350222Z :rtype: requests.Response
2021-05-22T00:06:09.1350620Z """
2021-05-22T00:06:09.1351120Z # Set defaults that the hooks can utilize to ensure they always have
2021-05-22T00:06:09.1351821Z # the correct parameters to reproduce the previous request.
2021-05-22T00:06:09.1352640Z kwargs.setdefault('stream', self.stream)
2021-05-22T00:06:09.1353400Z kwargs.setdefault('verify', self.verify)
2021-05-22T00:06:09.1354147Z kwargs.setdefault('cert', self.cert)
2021-05-22T00:06:09.1354901Z kwargs.setdefault('proxies', self.proxies)
2021-05-22T00:06:09.1355377Z
2021-05-22T00:06:09.1356052Z # It's possible that users might accidentally send a Request object.
2021-05-22T00:06:09.1356695Z # Guard against that specific failure case.
2021-05-22T00:06:09.1357245Z if isinstance(request, Request):
2021-05-22T00:06:09.1358019Z raise ValueError('You can only send PreparedRequests.')
2021-05-22T00:06:09.1358533Z
2021-05-22T00:06:09.1359060Z # Set up variables needed for resolve_redirects and dispatching of hooks
2021-05-22T00:06:09.1359924Z allow_redirects = kwargs.pop('allow_redirects', True)
2021-05-22T00:06:09.1360784Z stream = kwargs.get('stream')
2021-05-22T00:06:09.1361261Z hooks = request.hooks
2021-05-22T00:06:09.1361610Z
2021-05-22T00:06:09.1362023Z # Get the appropriate adapter to use
2021-05-22T00:06:09.1362603Z adapter = self.get_adapter(url=request.url)
2021-05-22T00:06:09.1363032Z
2021-05-22T00:06:09.1363464Z # Start time (approximately) of the request
2021-05-22T00:06:09.1363971Z start = preferred_clock()
2021-05-22T00:06:09.1364340Z
2021-05-22T00:06:09.1364663Z # Send the request
2021-05-22T00:06:09.1365131Z > r = adapter.send(request, **kwargs)
2021-05-22T00:06:09.1365456Z
2021-05-22T00:06:09.1366258Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/requests/sessions.py:655:
2021-05-22T00:06:09.1366934Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1367190Z
2021-05-22T00:06:09.1367785Z self = <requests.adapters.HTTPAdapter object at 0x7f84e2917650>
2021-05-22T00:06:09.1368575Z request = <PreparedRequest [GET]>, stream = False
2021-05-22T00:06:09.1369232Z timeout = Timeout(connect=5, read=30, total=None), verify = True, cert = None
2021-05-22T00:06:09.1369813Z proxies = OrderedDict()
2021-05-22T00:06:09.1370174Z
2021-05-22T00:06:09.1370732Z def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
2021-05-22T00:06:09.1371544Z """Sends PreparedRequest object. Returns Response object.
2021-05-22T00:06:09.1372049Z
2021-05-22T00:06:09.1372650Z :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
2021-05-22T00:06:09.1373451Z :param stream: (optional) Whether to stream the request content.
2021-05-22T00:06:09.1374144Z :param timeout: (optional) How long to wait for the server to send
2021-05-22T00:06:09.1374809Z data before giving up, as a float, or a :ref:`(connect timeout,
2021-05-22T00:06:09.1375374Z read timeout) <timeouts>` tuple.
2021-05-22T00:06:09.1375947Z :type timeout: float or tuple or urllib3 Timeout object
2021-05-22T00:06:09.1376638Z :param verify: (optional) Either a boolean, in which case it controls whether
2021-05-22T00:06:09.1377567Z we verify the server's TLS certificate, or a string, in which case it
2021-05-22T00:06:09.1378167Z must be a path to a CA bundle to use
2021-05-22T00:06:09.1378978Z :param cert: (optional) Any user-provided SSL certificate to be trusted.
2021-05-22T00:06:09.1379763Z :param proxies: (optional) The proxies dictionary to apply to the request.
2021-05-22T00:06:09.1380421Z :rtype: requests.Response
2021-05-22T00:06:09.1380835Z """
2021-05-22T00:06:09.1381108Z
2021-05-22T00:06:09.1381398Z try:
2021-05-22T00:06:09.1381872Z conn = self.get_connection(request.url, proxies)
2021-05-22T00:06:09.1382500Z except LocationValueError as e:
2021-05-22T00:06:09.1383074Z raise InvalidURL(e, request=request)
2021-05-22T00:06:09.1383494Z
2021-05-22T00:06:09.1383950Z self.cert_verify(conn, request.url, verify, cert)
2021-05-22T00:06:09.1384562Z url = self.request_url(request, proxies)
2021-05-22T00:06:09.1385336Z self.add_headers(request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
2021-05-22T00:06:09.1385965Z
2021-05-22T00:06:09.1386710Z chunked = not (request.body is None or 'Content-Length' in request.headers)
2021-05-22T00:06:09.1387276Z
2021-05-22T00:06:09.1387664Z if isinstance(timeout, tuple):
2021-05-22T00:06:09.1388058Z try:
2021-05-22T00:06:09.1388442Z connect, read = timeout
2021-05-22T00:06:09.1388994Z timeout = TimeoutSauce(connect=connect, read=read)
2021-05-22T00:06:09.1389560Z except ValueError as e:
2021-05-22T00:06:09.1390072Z # this may raise a string formatting error.
2021-05-22T00:06:09.1390651Z err = ("Invalid timeout {}. Pass a (connect, read) "
2021-05-22T00:06:09.1391318Z "timeout tuple, or a single float to set "
2021-05-22T00:06:09.1391896Z "both timeouts to the same value".format(timeout))
2021-05-22T00:06:09.1392430Z raise ValueError(err)
2021-05-22T00:06:09.1392952Z elif isinstance(timeout, TimeoutSauce):
2021-05-22T00:06:09.1393417Z pass
2021-05-22T00:06:09.1393729Z else:
2021-05-22T00:06:09.1394236Z timeout = TimeoutSauce(connect=timeout, read=timeout)
2021-05-22T00:06:09.1395232Z
2021-05-22T00:06:09.1395523Z try:
2021-05-22T00:06:09.1395867Z if not chunked:
2021-05-22T00:06:09.1396277Z resp = conn.urlopen(
2021-05-22T00:06:09.1396765Z method=request.method,
2021-05-22T00:06:09.1397181Z url=url,
2021-05-22T00:06:09.1397591Z body=request.body,
2021-05-22T00:06:09.1398082Z headers=request.headers,
2021-05-22T00:06:09.1398566Z redirect=False,
2021-05-22T00:06:09.1398994Z assert_same_host=False,
2021-05-22T00:06:09.1399453Z preload_content=False,
2021-05-22T00:06:09.1399899Z decode_content=False,
2021-05-22T00:06:09.1400536Z retries=self.max_retries,
2021-05-22T00:06:09.1400992Z timeout=timeout
2021-05-22T00:06:09.1401336Z )
2021-05-22T00:06:09.1401624Z
2021-05-22T00:06:09.1401955Z # Send the request.
2021-05-22T00:06:09.1402325Z else:
2021-05-22T00:06:09.1402913Z if hasattr(conn, 'proxy_pool'):
2021-05-22T00:06:09.1403387Z conn = conn.proxy_pool
2021-05-22T00:06:09.1403737Z
2021-05-22T00:06:09.1404200Z low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT)
2021-05-22T00:06:09.1404638Z
2021-05-22T00:06:09.1404935Z try:
2021-05-22T00:06:09.1405414Z low_conn.putrequest(request.method,
2021-05-22T00:06:09.1405934Z url,
2021-05-22T00:06:09.1406390Z skip_accept_encoding=True)
2021-05-22T00:06:09.1406777Z
2021-05-22T00:06:09.1407295Z for header, value in request.headers.items():
2021-05-22T00:06:09.1407941Z low_conn.putheader(header, value)
2021-05-22T00:06:09.1408368Z
2021-05-22T00:06:09.1408746Z low_conn.endheaders()
2021-05-22T00:06:09.1409126Z
2021-05-22T00:06:09.1409490Z for i in request.body:
2021-05-22T00:06:09.1410175Z low_conn.send(hex(len(i))[2:].encode('utf-8'))
2021-05-22T00:06:09.1410796Z low_conn.send(b'\r\n')
2021-05-22T00:06:09.1411219Z low_conn.send(i)
2021-05-22T00:06:09.1411771Z low_conn.send(b'\r\n')
2021-05-22T00:06:09.1412327Z low_conn.send(b'0\r\n\r\n')
2021-05-22T00:06:09.1412691Z
2021-05-22T00:06:09.1413111Z # Receive the response from the server
2021-05-22T00:06:09.1413558Z try:
2021-05-22T00:06:09.1414030Z # For Python 2.7, use buffering of HTTP responses
2021-05-22T00:06:09.1414670Z r = low_conn.getresponse(buffering=True)
2021-05-22T00:06:09.1415202Z except TypeError:
2021-05-22T00:06:09.1415713Z # For compatibility with Python 3.3+
2021-05-22T00:06:09.1416257Z r = low_conn.getresponse()
2021-05-22T00:06:09.1416645Z
2021-05-22T00:06:09.1417104Z resp = HTTPResponse.from_httplib(
2021-05-22T00:06:09.1417565Z r,
2021-05-22T00:06:09.1417915Z pool=conn,
2021-05-22T00:06:09.1418323Z connection=low_conn,
2021-05-22T00:06:09.1418790Z preload_content=False,
2021-05-22T00:06:09.1419328Z decode_content=False
2021-05-22T00:06:09.1419714Z )
2021-05-22T00:06:09.1420040Z except:
2021-05-22T00:06:09.1420552Z # If we hit any problems here, clean up the connection.
2021-05-22T00:06:09.1421232Z # Then, reraise so that we can handle the actual exception.
2021-05-22T00:06:09.1421770Z low_conn.close()
2021-05-22T00:06:09.1422153Z raise
2021-05-22T00:06:09.1422448Z
2021-05-22T00:06:09.1422920Z except (ProtocolError, socket.error) as err:
2021-05-22T00:06:09.1423573Z raise ConnectionError(err, request=request)
2021-05-22T00:06:09.1424038Z
2021-05-22T00:06:09.1424417Z except MaxRetryError as e:
2021-05-22T00:06:09.1425037Z if isinstance(e.reason, ConnectTimeoutError):
2021-05-22T00:06:09.1425624Z # TODO: Remove this in 3.0.0: see #2811
2021-05-22T00:06:09.1426229Z if not isinstance(e.reason, NewConnectionError):
2021-05-22T00:06:09.1426927Z raise ConnectTimeout(e, request=request)
2021-05-22T00:06:09.1427368Z
2021-05-22T00:06:09.1427819Z if isinstance(e.reason, ResponseError):
2021-05-22T00:06:09.1428485Z raise RetryError(e, request=request)
2021-05-22T00:06:09.1428906Z
2021-05-22T00:06:09.1429326Z if isinstance(e.reason, _ProxyError):
2021-05-22T00:06:09.1429900Z raise ProxyError(e, request=request)
2021-05-22T00:06:09.1430311Z
2021-05-22T00:06:09.1430722Z if isinstance(e.reason, _SSLError):
2021-05-22T00:06:09.1431414Z # This branch is for urllib3 v1.22 and later.
2021-05-22T00:06:09.1431985Z raise SSLError(e, request=request)
2021-05-22T00:06:09.1432506Z
2021-05-22T00:06:09.1432998Z raise ConnectionError(e, request=request)
2021-05-22T00:06:09.1433527Z
2021-05-22T00:06:09.1455612Z except ClosedPoolError as e:
2021-05-22T00:06:09.1456388Z raise ConnectionError(e, request=request)
2021-05-22T00:06:09.1456863Z
2021-05-22T00:06:09.1457237Z except _ProxyError as e:
2021-05-22T00:06:09.1457696Z raise ProxyError(e)
2021-05-22T00:06:09.1458053Z
2021-05-22T00:06:09.1458468Z except (_SSLError, _HTTPError) as e:
2021-05-22T00:06:09.1458972Z if isinstance(e, _SSLError):
2021-05-22T00:06:09.1459548Z # This branch is for urllib3 versions earlier than v1.22
2021-05-22T00:06:09.1460145Z raise SSLError(e, request=request)
2021-05-22T00:06:09.1460727Z elif isinstance(e, ReadTimeoutError):
2021-05-22T00:06:09.1461338Z > raise ReadTimeout(e, request=request)
2021-05-22T00:06:09.1462748Z E requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='beaconcha.in', port=443): Read timed out. (read timeout=30)
2021-05-22T00:06:09.1463551Z
2021-05-22T00:06:09.1464429Z /opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/requests/adapters.py:529: ReadTimeout
2021-05-22T00:06:09.1465022Z
2021-05-22T00:06:09.1465524Z The above exception was the direct cause of the following exception:
2021-05-22T00:06:09.1465958Z
2021-05-22T00:06:09.1466955Z session_beaconchain = <rotkehlchen.externalapis.beaconchain.BeaconChain object at 0x7f850e4b0350>
2021-05-22T00:06:09.1467893Z
2021-05-22T00:06:09.1468375Z def test_get_balance_history_single(session_beaconchain):
2021-05-22T00:06:09.1469052Z > balance_map = session_beaconchain.get_balance_history([9])
2021-05-22T00:06:09.1469462Z
2021-05-22T00:06:09.1469961Z rotkehlchen/tests/external_apis/test_beaconchain.py:43:
2021-05-22T00:06:09.1470500Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1471103Z rotkehlchen/externalapis/beaconchain.py:169: in get_balance_history
2021-05-22T00:06:09.1471897Z encoded_args=','.join(str(x) for x in chunk),
2021-05-22T00:06:09.1472531Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-05-22T00:06:09.1472788Z
2021-05-22T00:06:09.1473734Z self = <rotkehlchen.externalapis.beaconchain.BeaconChain object at 0x7f850e4b0350>
2021-05-22T00:06:09.1475088Z module = 'validator', endpoint = 'balancehistory', encoded_args = '9'
2021-05-22T00:06:09.1475523Z
2021-05-22T00:06:09.1475822Z def _query(
2021-05-22T00:06:09.1476166Z self,
2021-05-22T00:06:09.1476691Z module: Literal['validator'],
2021-05-22T00:06:09.1477464Z endpoint: Literal['balancehistory', 'performance', 'eth1'],
2021-05-22T00:06:09.1478029Z encoded_args: str,
2021-05-22T00:06:09.1478625Z ) -> Union[List[Dict[str, Any]], Dict[str, Any]]:
2021-05-22T00:06:09.1479024Z """
2021-05-22T00:06:09.1479332Z May raise:
2021-05-22T00:06:09.1480015Z - RemoteError due to problems querying beaconcha.in API
2021-05-22T00:06:09.1480624Z """
2021-05-22T00:06:09.1481109Z if endpoint == 'eth1':
2021-05-22T00:06:09.1481789Z query_str = f'{self.url}{module}/{endpoint}/{encoded_args}'
2021-05-22T00:06:09.1482279Z else:
2021-05-22T00:06:09.1482903Z query_str = f'{self.url}{module}/{encoded_args}/{endpoint}'
2021-05-22T00:06:09.1483548Z api_key = self._get_api_key()
2021-05-22T00:06:09.1483963Z if api_key is not None:
2021-05-22T00:06:09.1484547Z query_str += f'?apikey={api_key}'
2021-05-22T00:06:09.1485003Z times = QUERY_RETRY_TIMES
2021-05-22T00:06:09.1485416Z backoff_in_seconds = 10
2021-05-22T00:06:09.1485768Z
2021-05-22T00:06:09.1486400Z logger.debug(f'Querying beaconcha.in API for {query_str}')
2021-05-22T00:06:09.1486938Z while True:
2021-05-22T00:06:09.1487262Z try:
2021-05-22T00:06:09.1487849Z response = self.session.get(query_str, timeout=DEFAULT_TIMEOUT_TUPLE)
2021-05-22T00:06:09.1488810Z except requests.exceptions.RequestException as e:
2021-05-22T00:06:09.1489893Z > raise RemoteError(f'Querying {query_str} failed due to {str(e)}') from e
2021-05-22T00:06:09.1491612Z E rotkehlchen.errors.RemoteError: Querying https://beaconcha.in/api/v1/validator/9/balancehistory failed due to HTTPSConnectionPool(host='beaconcha.in', port=443): Read timed out. (read timeout=30)
2021-05-22T00:06:09.1492725Z
2021-05-22T00:06:09.1493258Z rotkehlchen/externalapis/beaconchain.py:70: RemoteError
2021-05-22T00:06:09.1494174Z ----------------------------- Captured stderr call -----------------------------
2021-05-22T00:06:09.1495441Z [22/05/2021 00:02:44 UTC] DEBUG rotkehlchen.externalapis.beaconchain: Querying beaconcha.in API for https://beaconcha.in/api/v1/validator/9/balancehistory
2021-05-22T00:06:09.1496840Z ------------------------------ Captured log call -------------------------------
2021-05-22T00:06:09.1498143Z DEBUG rotkehlchen.externalapis.beaconchain:beaconchain.py:65 Querying beaconcha.in API for https://beaconcha.in/api/v1/validator/9/balancehistory
2021-05-22T00:06:09.1499313Z =============================== warnings summary ===============================
2021-05-22T00:06:09.1501537Z rotkehlchen/tests/api/test_yearn_vaults.py::test_query_yearn_vault_history[https://mainnet.infura.io/v3/66302b8fb9874614905a3cbe903a0dbb-ethereum_manager_connect_at_start0-True-default_mock_price_value0-True-True-ethereum_modules0-ethereum_accounts0]
2021-05-22T00:06:09.1503769Z rotkehlchen/tests/unit/test_ethereum_manager.py::
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment