From 721f2a0d697b61b0e3cc03f7ba9a7297b2315e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sat, 2 Apr 2016 22:05:10 +0200 Subject: [PATCH] Handle content-type header with parameters when debugging requests --- pyicloud/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyicloud/base.py b/pyicloud/base.py index c58de3d..3b9711b 100644 --- a/pyicloud/base.py +++ b/pyicloud/base.py @@ -65,8 +65,9 @@ class PyiCloudSession(requests.Session): response = super(PyiCloudSession, self).request(*args, **kwargs) + content_type = response.headers.get('Content-Type', '').split(';')[0] json_mimetypes = ['application/json', 'text/json'] - if not response.headers['Content-Type'] in json_mimetypes: + if content_type not in json_mimetypes: return response try: