nlbone 0.8.1__py3-none-any.whl → 0.8.2__py3-none-any.whl

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.
nlbone/utils/http.py CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import json
4
4
  from typing import Any
5
- from urllib.parse import urlparse, urlunparse, urlsplit, urlunsplit
5
+ from urllib.parse import urlparse, urlunparse
6
6
 
7
7
  from nlbone.utils.context import current_request
8
8
 
@@ -32,14 +32,6 @@ def normalize_https_base(url: str, enforce_https: bool = True) -> str:
32
32
 
33
33
 
34
34
  def get_service_base_url() -> str:
35
- req = current_request()
36
-
37
- base_url = req.base_url
38
- if isinstance(base_url, (bytes, bytearray)):
39
- base_url = base_url.decode("utf-8", "strict")
40
-
41
- forwarded_proto = (req.headers.get("x-forwarded-proto") or "").split(",")[0].strip().lower()
42
- scheme = forwarded_proto if forwarded_proto in {"http", "https"} else urlsplit(base_url).scheme or "http"
43
-
44
- parts = urlsplit(base_url)
45
- return urlunsplit((scheme, parts.netloc, parts.path, "", ""))
35
+ req = current_request() # Starlette Request
36
+ url = req.base_url # URL object
37
+ return str(url.replace(scheme="https"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nlbone
3
- Version: 0.8.1
3
+ Version: 0.8.2
4
4
  Summary: Backbone package for interfaces and infrastructure in Python projects
5
5
  Author-email: Amir Hosein Kahkbazzadeh <a.khakbazzadeh@gmail.com>
6
6
  License: MIT
@@ -111,12 +111,12 @@ nlbone/utils/context.py,sha256=Wq3QLYsMzo_xUiVAHLgEPQUG6LhgJTmFn8MO5Qa7S8w,1837
111
111
  nlbone/utils/crypto.py,sha256=PX0Tlf2nqXcGbuv16J26MoUPzo2c4xcD4sZBXxhBXgQ,746
112
112
  nlbone/utils/flatten_dict.py,sha256=nkx8gAcJkjCKG3I5y9clqtjGMZCWyUWRhgD2R8zGEqM,299
113
113
  nlbone/utils/flatten_sqlalchemy_result.py,sha256=JGwQEauoJVjhzvXrOtqabj3wQ7zp2-OPwhuh44sUdUE,625
114
- nlbone/utils/http.py,sha256=Jr15AqXUZKcVfN7-_4SbIGXHr6RWb5TkDHChgCOTxMY,1451
114
+ nlbone/utils/http.py,sha256=llb4aPDL-Uvrht3c_VwJdngdKeT4WsCu1pXSoeI7vWA,1114
115
115
  nlbone/utils/normalize_mobile.py,sha256=sGH4tV9gX-6eVKozviNWJhm1DN1J28Nj-ERldCYkS_E,732
116
116
  nlbone/utils/redactor.py,sha256=-V4HrHmHwPi3Kez587Ek1uJlgK35qGSrwBOvcbw8Jas,1279
117
117
  nlbone/utils/time.py,sha256=DjjyQ9GLsfXoT6NK8RDW2rOlJg3e6sF04Jw6PBUrSvg,1268
118
- nlbone-0.8.1.dist-info/METADATA,sha256=usSyN8iAxBHjnqy16NmMevqKcKHc8G5bVLgyHtGzPx0,2294
119
- nlbone-0.8.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
120
- nlbone-0.8.1.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
121
- nlbone-0.8.1.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
- nlbone-0.8.1.dist-info/RECORD,,
118
+ nlbone-0.8.2.dist-info/METADATA,sha256=U98QL0qunT7iz-N8KrbuowCD_QYC47K_YiYcPfH8IuY,2294
119
+ nlbone-0.8.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
120
+ nlbone-0.8.2.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
121
+ nlbone-0.8.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
+ nlbone-0.8.2.dist-info/RECORD,,
File without changes