diff options
| author | 2019-12-11 11:18:19 +0000 | |
|---|---|---|
| committer | 2019-12-11 11:18:19 +0000 | |
| commit | 5a2905de013a77f954cbee328f99b3bd5c677bea (patch) | |
| tree | 3be3febc43acf6326d8b3bf25b06e7b3f0804b3d /src/utils/http.py | |
| parent | allow users to set command-method for PMs with them (diff) | |
| signature | ||
allow Request objects to specify their timeout
Diffstat (limited to 'src/utils/http.py')
| -rw-r--r-- | src/utils/http.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/utils/http.py b/src/utils/http.py index eda5b947..6fe6be53 100644 --- a/src/utils/http.py +++ b/src/utils/http.py @@ -76,6 +76,8 @@ class Request(object): proxy: typing.Optional[str] = None useragent: typing.Optional[str] = None + timeout: int=5 + def validate(self): self.id = self.id or str(uuid.uuid4()) self.set_url(self.url) @@ -186,7 +188,7 @@ def _request(request_obj: Request) -> Response: return our_response try: - response = utils.deadline_process(_wrap, seconds=5) + response = utils.deadline_process(_wrap, seconds=request_obj.timeout) except utils.DeadlineExceededException: raise HTTPTimeoutException() |
