aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2020-04-12 11:14:49 +0200
committerneodarz <neodarz@neodarz.net>2020-04-12 11:14:49 +0200
commit9547b163e3c3c717cb465c8f4019d9b107df0b63 (patch)
tree967a8fceceaba06de2c8313d78e245044865656b
parent7485bb63466f17febe2e165940bdc6d70e2e715f (diff)
downloadpyfunkwhale-9547b163e3c3c717cb465c8f4019d9b107df0b63.tar.xz
pyfunkwhale-9547b163e3c3c717cb465c8f4019d9b107df0b63.zip
Add ability to set the header when calling the application
-rw-r--r--pyfunkwhale/client.py7
1 files 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)