lsrestclient 2.0.0__py3-none-any.whl → 2.0.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
lsrestclient/response.py CHANGED
@@ -6,7 +6,6 @@ import pydash
6
6
  from requests import Response
7
7
  from requests.structures import CaseInsensitiveDict
8
8
 
9
-
10
9
  @dataclass
11
10
  class LsRestClientResponse:
12
11
  """
@@ -36,9 +35,16 @@ class LsRestClientResponse:
36
35
  """
37
36
 
38
37
  encoding = pydash.get(response, "encoding", None)
38
+ headers = pydash.get(response, "headers", None)
39
+ content_type = headers.get("Content-Type", None)
40
+ if content_type == 'application/pdf':
41
+ content = response.content
42
+ else:
43
+ content = response.content.decode("utf8" if encoding is None else encoding)
44
+
39
45
  return cls(
40
46
  status_code=response.status_code,
41
- content=response.content.decode("utf8" if encoding is None else encoding),
47
+ content=content,
42
48
  headers=response.headers,
43
49
  )
44
50
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lsrestclient
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: REST Api Client
5
5
  Author: mba
6
6
  Author-email: bartel@electronic-shop.lu
@@ -6,8 +6,8 @@ lsrestclient/contexts/bearer_token.py,sha256=GZZOzAI2Ng_9DvFCbhv1Wwb8wJ1AYCca3fQ
6
6
  lsrestclient/exceptions.py,sha256=IkIk9bLUHv_Ds9oJ24fbdpdP2nnoUQM5RGX25hzQSdI,2197
7
7
  lsrestclient/fixtures.py,sha256=dFkAYQXL6xqTOwRofb03Nsu_cIjq1sG10Rh8dxWfz9s,239
8
8
  lsrestclient/mock.py,sha256=Ya12F0t5sXHTSt-X4jDDj5ILJx6y6QaBAMXutQMsIRI,1376
9
- lsrestclient/response.py,sha256=Bj9X9jQT2hI0jbXrxDasjDczo3QVWAj_J6yaElBQegw,1923
10
- lsrestclient-2.0.0.dist-info/METADATA,sha256=4JzX2tULgW7EnU5EQUHkhsoaRjNq3At3A7Y3O8KIAiU,6748
11
- lsrestclient-2.0.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
12
- lsrestclient-2.0.0.dist-info/entry_points.txt,sha256=7lN1XN3lq5Jv5PlpOdIlFrLlFlwzE5MaEWSgMhKASOM,47
13
- lsrestclient-2.0.0.dist-info/RECORD,,
9
+ lsrestclient/response.py,sha256=zVisLH4TMG5Ww9gseLSb1rVpHUESoR03DNpL0bv1GCU,2165
10
+ lsrestclient-2.0.1.dist-info/METADATA,sha256=rJ5Ag5ALBQkoTaF_Ix1sEzslG8cqYq898BARzd61eBk,6748
11
+ lsrestclient-2.0.1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
12
+ lsrestclient-2.0.1.dist-info/entry_points.txt,sha256=7lN1XN3lq5Jv5PlpOdIlFrLlFlwzE5MaEWSgMhKASOM,47
13
+ lsrestclient-2.0.1.dist-info/RECORD,,