import order and spaces
This commit is contained in:
@ -2,9 +2,9 @@ import requests
|
||||
import functools
|
||||
import json
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from .authmixin import AuthMixin, AuthError, HEADER_JSON
|
||||
|
||||
|
||||
def authenticated(func):
|
||||
@functools.wraps(func)
|
||||
def authenticated_call(*args, **kwargs):
|
||||
@ -15,11 +15,12 @@ def authenticated(func):
|
||||
else:
|
||||
kwargs["headers"] = {}
|
||||
kwargs["headers"]["Authorization"] = args[0].token
|
||||
|
||||
return func(*args, **kwargs)
|
||||
return authenticated_call
|
||||
|
||||
|
||||
class HttpClient(AuthMixin):
|
||||
|
||||
def __init__(self, address):
|
||||
self.address = address
|
||||
self._verify_certificate = True
|
||||
@ -48,7 +49,6 @@ class HttpClient(AuthMixin):
|
||||
self.config.delete()
|
||||
raise response.raise_for_status()
|
||||
|
||||
|
||||
@authenticated
|
||||
def post_request(self, url, payload=None, headers=None, timeout=10):
|
||||
response = requests.post(url, json=payload, headers=headers, timeout=timeout, verify=self._verify_certificate).json()
|
||||
|
Reference in New Issue
Block a user