canonicalwebteam.store-api 7.3.5__tar.gz → 7.3.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (14) hide show
  1. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/PKG-INFO +1 -1
  2. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/store_api/base.py +17 -1
  3. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/pyproject.toml +1 -1
  4. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/LICENSE +0 -0
  5. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/README.md +0 -0
  6. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/__init__.py +0 -0
  7. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/exceptions.py +0 -0
  8. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/retry_utils.py +0 -0
  9. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/store_api/__init__.py +0 -0
  10. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/store_api/dashboard.py +0 -0
  11. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/store_api/devicegw.py +0 -0
  12. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/store_api/publishergw.py +0 -0
  13. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/stores_web_redis/__init__.py +0 -0
  14. {canonicalwebteam_store_api-7.3.5 → canonicalwebteam_store_api-7.3.6}/canonicalwebteam/stores_web_redis/utility.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: canonicalwebteam.store-api
3
- Version: 7.3.5
3
+ Version: 7.3.6
4
4
  Summary:
5
5
  License: LGPL-3.0
6
6
  License-File: LICENSE
@@ -30,12 +30,28 @@ def _sanitize_dict(dictionary):
30
30
  return result
31
31
 
32
32
 
33
+ def _get_request_body(request) -> str:
34
+ body = request.body
35
+ if isinstance(body, (bytes, bytearray)):
36
+ # try to decode utf-8
37
+ try:
38
+ body = body.decode()
39
+ except UnicodeError:
40
+ # we don't want to guess so we just print the body's length
41
+ body = f"<len {len(body)}>"
42
+ elif not isinstance(body, str):
43
+ # we don't know if the type will be JSON serializable
44
+ # so we just print the type
45
+ body = f"{type(body)}"
46
+ return body
47
+
48
+
33
49
  def _loggable_request(request):
34
50
  return {
35
51
  "url": request.url,
36
52
  "headers": _sanitize_dict(request.headers),
37
53
  "cookies": _sanitize_dict(request._cookies),
38
- "body": request.body,
54
+ "body": _get_request_body(request),
39
55
  }
40
56
 
41
57
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = 'canonicalwebteam.store-api'
3
- version = '7.3.5'
3
+ version = '7.3.6'
4
4
  description = ''
5
5
  authors = ['Canonical Web Team <webteam@canonical.com>']
6
6
  license = 'LGPL-3.0'