requests wrapper: refacto: remove useless decorator
-import functools
-
import requests
from . import exceptions
from .config import requests_get_params
-def parse_response(f):
- @functools.wraps(f)
- def wrapper(*args, **kwargs):
+def _req(fn, config, url, **kwargs):
+
+ default_kwargs, headers = requests_get_params(config)
+ kwargs.update(default_kwargs)
+
try:
- r = f(*args, **kwargs)
+ r = fn(url, headers=headers, **kwargs)
r.raise_for_status()
except requests.exceptions.ConnectionError as e:
@@ -42,14 +42,6 @@ def parse_response(f):
raise exceptions.InvalidResponse(r, msg)
return result
- return wrapper
-
-
-@parse_response
-def _req(fn, config, url, **kwargs):
- default_kwargs, headers = requests_get_params(config)
- kwargs.update(default_kwargs)
- return fn(url, headers=headers, **kwargs)
def post(config, url, data, **kwargs):
