MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / SourceAddressAdapter

Class SourceAddressAdapter

daily/chinaUnicom.py:260–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258 import socket
259
260 class SourceAddressAdapter(HTTPAdapter):
261
262 def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs):
263 pool_kwargs['source_address'] = ('0.0.0.0', 0)
264 super(SourceAddressAdapter, self).init_poolmanager(connections, maxsize, block, **pool_kwargs)
265
266 def get_connection(self, url, proxies=None):
267 return super(SourceAddressAdapter, self).get_connection(url, proxies)
268 retries = Retry(total=3, backoff_factor=1, status_forcelist=[500, 502, 503, 504])
269 adapter = SourceAddressAdapter(max_retries=retries)
270 raw_session.mount('http://', adapter)

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected