MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MDX / SpeedtestHTTPSHandler

Class SpeedtestHTTPSHandler

lib/speed.py:558–580  ·  view source on GitHub ↗

Custom ``HTTPSHandler`` that can build a ``HTTPSConnection`` with the args we need for ``source_address`` and ``timeout``

Source from the content-addressed store, hash-verified

556
557
558class SpeedtestHTTPSHandler(AbstractHTTPHandler):
559 """Custom ``HTTPSHandler`` that can build a ``HTTPSConnection`` with the
560 args we need for ``source_address`` and ``timeout``
561 """
562 def __init__(self, debuglevel=0, context=None, source_address=None,
563 timeout=10):
564 AbstractHTTPHandler.__init__(self, debuglevel)
565 self._context = context
566 self.source_address = source_address
567 self.timeout = timeout
568
569 def https_open(self, req):
570 return self.do_open(
571 _build_connection(
572 SpeedtestHTTPSConnection,
573 self.source_address,
574 self.timeout,
575 context=self._context,
576 ),
577 req
578 )
579
580 https_request = AbstractHTTPHandler.do_request_
581
582
583def build_opener(source_address=None, timeout=10):

Callers 1

build_openerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected