From 9547b163e3c3c717cb465c8f4019d9b107df0b63 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sun, 12 Apr 2020 11:14:49 +0200 Subject: Add ability to set the header when calling the application --- pyfunkwhale/client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyfunkwhale/client.py b/pyfunkwhale/client.py index 4372460..95907f7 100644 --- a/pyfunkwhale/client.py +++ b/pyfunkwhale/client.py @@ -91,7 +91,7 @@ class Client(object): return self.call('/token', 'post', data=data).json() def call(self, endpoint: str, method: str, params: dict = None, - data: dict = None) -> Response: + data: dict = None, headers: dict = None) -> Response: """ Call the API @@ -112,8 +112,9 @@ class Client(object): If their is an error during requesting the API. """ self._refresh_token() - headers = {'Authorization': self.token['token_type'] + ' ' + - self.token['access_token']} + if headers is None: + headers = {'Authorization': self.token['token_type'] + ' ' + + self.token['access_token']} call = getattr(self.oauth_client, method) -- cgit v1.2.1