From 9ab6caef3c048b254b55fae422c64ebafd330296 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sun, 12 Apr 2020 11:15:24 +0200 Subject: Force refersh token if it invalid when calling the API --- pyfunkwhale/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyfunkwhale/client.py b/pyfunkwhale/client.py index 95907f7..53e7a66 100644 --- a/pyfunkwhale/client.py +++ b/pyfunkwhale/client.py @@ -123,6 +123,11 @@ class Client(object): r = call(self.domain + '/api/v1/' + endpoint, headers=headers, params=params, data=data) + if r.status_code == 401: + self._force_refresh_token() + r = call(self.domain + '/api/v1/' + endpoint, headers=headers, + params=params, data=data) + r.raise_for_status() return r -- cgit v1.2.1