about summary refs log tree commit diff
path: root/uploader/monadic_requests.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-06-11 05:37:30 -0500
committerFrederick Muriuki Muriithi2025-06-11 05:37:30 -0500
commit91df005212363108f4deb31dc0fc81e2424547ce (patch)
tree51666cad37a262c8d82b5391a1ab668fe7d63d3e /uploader/monadic_requests.py
parent34161e8f6147120eae6530d9de501b0866bb84c6 (diff)
downloadgn-uploader-91df005212363108f4deb31dc0fc81e2424547ce.tar.gz
Fix issues caught by linter.
Diffstat (limited to 'uploader/monadic_requests.py')
-rw-r--r--uploader/monadic_requests.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/uploader/monadic_requests.py b/uploader/monadic_requests.py
index f1f5c77..eda42d0 100644
--- a/uploader/monadic_requests.py
+++ b/uploader/monadic_requests.py
@@ -59,6 +59,11 @@ def get(url, params=None, **kwargs) -> Either:
 
     :rtype: pymonad.either.Either
     """
+    timeout = kwargs.get("timeout")
+    kwargs = {key: val for key,val in kwargs.items() if key != "timeout"}
+    if timeout is None:
+        timeout = (9.13, 20)
+
     try:
         resp = requests.get(url, params=params, **kwargs)
         if resp.status_code in SUCCESS_CODES:
@@ -76,6 +81,11 @@ def post(url, data=None, json=None, **kwargs) -> Either:
 
     :rtype: pymonad.either.Either
     """
+    timeout = kwargs.get("timeout")
+    kwargs = {key: val for key,val in kwargs.items() if key != "timeout"}
+    if timeout is None:
+        timeout = (9.13, 20)
+
     try:
         resp = requests.post(url, data=data, json=json, **kwargs)
         if resp.status_code in SUCCESS_CODES:
@@ -95,10 +105,10 @@ def make_either_error_handler(msg):
             try:
                 _data = error.json()
             except Exception as _exc:
-                raise Exception(error.content) from _exc
-            raise Exception(_data)
+                raise Exception(error.content) from _exc# pylint: disable=[broad-exception-raised]
+            raise Exception(_data)# pylint: disable=[broad-exception-raised]
 
         app.logger.debug("\n\n%s\n\n", msg)
-        raise Exception(error)
+        raise Exception(error)# pylint: disable=[broad-exception-raised]
 
     return __fail__