diff options
author | neodarz <neodarz@neodarz.net> | 2020-04-11 17:54:16 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2020-04-11 17:54:16 +0200 |
commit | 43d7b01351a314b52c1a9fda901be461abfaa5a1 (patch) | |
tree | ffb1288ae4216eb3959f2b70f9c54f050c1a0f36 | |
parent | 9af2a99f44e1c9d97a2bdb2b167b3d6a2e267179 (diff) | |
download | pyfunkwhale-43d7b01351a314b52c1a9fda901be461abfaa5a1.tar.xz pyfunkwhale-43d7b01351a314b52c1a9fda901be461abfaa5a1.zip |
Add ability to send params and data when request API
-rw-r--r-- | pyfunkwhale/client.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pyfunkwhale/client.py b/pyfunkwhale/client.py index fb89b54..06dda16 100644 --- a/pyfunkwhale/client.py +++ b/pyfunkwhale/client.py @@ -62,15 +62,14 @@ class Client(object): client_secret=self.client_secret) write_file(self.token_filename, self.token) - def call(self, endpoint, method): + def call(self, endpoint, method, params=None, data=None): self._refresh_token() headers = {'Authorization': self.token['token_type'] + ' ' + self.token['access_token']} call = getattr(self.oauth_client, method) - r = call( - self.domain + '/api/v1/' + endpoint, - headers=headers) + r = call(self.domain + '/api/v1/' + endpoint, headers=headers, + params=params, data=data) return r |