Initial commit

This commit is contained in:
Senad Uka
2019-10-20 13:16:49 +02:00
commit 233066caf4
2099 changed files with 360824 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
from requests.adapters import HTTPAdapter
class TimeoutAdapter(HTTPAdapter):
"""HTTP adapter that adds timeout to each query."""
def __init__(self, timeout=None, *args, **kwargs):
"""HTTP adapter that adds timeout to each query.
:param timeout: Timeout that will be added to each query
"""
self.timeout = timeout
super(TimeoutAdapter, self).__init__(*args, **kwargs)
def send(self, *args, **kwargs):
kwargs['timeout'] = self.timeout
return super(TimeoutAdapter, self).send(*args, **kwargs)