From 43d7b01351a314b52c1a9fda901be461abfaa5a1 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Apr 2020 17:54:16 +0200 Subject: Add ability to send params and data when request API --- pyfunkwhale/client.py | 7 +++---- 1 file 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 -- cgit v1.2.1