Commit 2bc923c9 authored by Marc-Andre Santune's avatar Marc-Andre Santune
Browse files

set timeout

parent 1b648ab6
...@@ -222,6 +222,7 @@ class BuildingGeneric: ...@@ -222,6 +222,7 @@ class BuildingGeneric:
url: str, url: str,
json: Optional[dict] = None, json: Optional[dict] = None,
headers: Optional[dict] = None, headers: Optional[dict] = None,
**kwargs
): ):
"""Request method. Retry if it failed""" """Request method. Retry if it failed"""
res = self._req(method=method, url=url, json=json, headers=headers) res = self._req(method=method, url=url, json=json, headers=headers)
...@@ -233,13 +234,15 @@ class BuildingGeneric: ...@@ -233,13 +234,15 @@ class BuildingGeneric:
url: str, url: str,
json: Optional[dict] = None, json: Optional[dict] = None,
headers: Optional[dict] = None, headers: Optional[dict] = None,
timeout=5,
**kwargs
): ):
"""Request method""" """Request method"""
if headers is None: if headers is None:
headers = {} headers = {}
headers = {**headers, "Api-Key": self.settings.api_key} headers = {**headers, "Api-Key": self.settings.api_key}
res = requests.request(method, url, json=json, headers=headers) res = requests.request(method, url, json=json, headers=headers, timeout=timeout, **kwargs)
res.raise_for_status() res.raise_for_status()
try: try:
return res.json() return res.json()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment