aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2020-04-12 11:15:24 +0200
committerneodarz <neodarz@neodarz.net>2020-04-12 11:15:24 +0200
commit9ab6caef3c048b254b55fae422c64ebafd330296 (patch)
treeaabf4945f2c443878273026c85e6af32f094c4ff
parent9547b163e3c3c717cb465c8f4019d9b107df0b63 (diff)
downloadpyfunkwhale-9ab6caef3c048b254b55fae422c64ebafd330296.tar.xz
pyfunkwhale-9ab6caef3c048b254b55fae422c64ebafd330296.zip
Force refersh token if it invalid when calling the API
-rw-r--r--pyfunkwhale/client.py5
1 files changed, 5 insertions, 0 deletions
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