From 4a5ad374f8f2e82374219f929cad3e95dc8d02e4 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 19 Apr 2022 18:39:42 +0200 Subject: [PATCH] fix UserClientFlask --- ereuse_devicehub/client.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/client.py b/ereuse_devicehub/client.py index 36d3bd49..31a9f136 100644 --- a/ereuse_devicehub/client.py +++ b/ereuse_devicehub/client.py @@ -254,7 +254,14 @@ class UserClientFlask: body = next(body).decode("utf-8") assert "Unassgined" in body - def get(self, uri='', data=None, follow_redirects=True, **kw): + def get( + self, + uri='', + data=None, + follow_redirects=True, + content_type='text/html; charset=utf-8', + **kw, + ): body, status, headers = self.client.get( uri, data=data, follow_redirects=follow_redirects, headers=self.headers @@ -262,10 +269,21 @@ class UserClientFlask: body = next(body).decode("utf-8") return (body, status) - def post(self, uri='', data=None, follow_redirects=True, **kw): + def post( + self, + uri='', + data=None, + follow_redirects=True, + content_type='application/x-www-form-urlencoded', + **kw, + ): body, status, headers = self.client.post( - uri, data=data, follow_redirects=follow_redirects, headers=self.headers + uri, + data=data, + follow_redirects=follow_redirects, + headers=self.headers, + content_type=content_type, ) body = next(body).decode("utf-8") return (body, status)