lsrestclient 2.0.0__tar.gz → 2.0.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,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
  [tool.poetry]
2
2
  name = "lsrestclient"
3
- version = "2.0.0"
3
+ version = "2.0.1"
4
4
  description = "REST Api Client"
5
5
  authors = ["mba <bartel@electronic-shop.lu>"]
6
6
  readme = "README.md"
File without changes