internal 0.1.64__py3-none-any.whl → 0.1.66__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.

Potentially problematic release.


This version of internal might be problematic. Click here for more details.

internal/http/requests.py CHANGED
@@ -5,16 +5,16 @@ from fastapi import FastAPI
5
5
  from ..exception.internal_exception import GatewayTimeoutException, BadGatewayException
6
6
 
7
7
 
8
- async def async_request(app: FastAPI, method, url, token=None, **kwargs):
8
+ async def async_request(app: FastAPI, method, url, current_user: dict = None, **kwargs):
9
9
  timeout = httpx.Timeout(connect=app.state.config.REQUEST_CONN_TIMEOUT, read=app.state.config.REQUEST_READ_TIMEOUT,
10
10
  write=app.state.config.REQUEST_WRITE_TIMEOUT, pool=app.state.config.REQUEST_POOL_TIMEOUT)
11
11
 
12
- if token:
12
+ if current_user and "access_token" in current_user:
13
13
  if "headers" in kwargs.keys():
14
- kwargs.get("headers")["Authorization"] = f"Bearer {token}"
14
+ kwargs.get("headers")["Authorization"] = f"Bearer {current_user.get('access_token')}"
15
15
  else:
16
16
  kwargs["headers"] = {
17
- "Authorization": f"Bearer {token}"
17
+ "Authorization": f"Bearer {current_user.get('access_token')}"
18
18
  }
19
19
 
20
20
  try:
@@ -6,7 +6,8 @@ from fastapi.responses import JSONResponse
6
6
  from beanie import Document, Link
7
7
 
8
8
 
9
- async def async_generate_content(data=None, message=None, code=None, page_no=None, total_num=None, page_size=None):
9
+ async def async_response(data=None, message=None, code=None, page_no=None, total_num=None, page_size=None,
10
+ status_code=status.HTTP_200_OK):
10
11
  def _serialize(data):
11
12
  if isinstance(data, Document):
12
13
  link_field_list = []
@@ -45,14 +46,4 @@ async def async_generate_content(data=None, message=None, code=None, page_no=Non
45
46
  else:
46
47
  ret['data'] = data
47
48
 
48
- return ret
49
-
50
-
51
- async def async_response(data=None, message=None, code=None, page_no=None, total_num=None, page_size=None,
52
- status_code=status.HTTP_200_OK):
53
- content = await async_generate_content(data=data, message=message, code=code, page_no=page_no, total_num=total_num,
54
- page_size=page_size)
55
- if isinstance(content, JSONResponse):
56
- return content
57
-
58
- return JSONResponse(status_code=status_code, content=content)
49
+ return JSONResponse(status_code=status_code, content=ret)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: internal
3
- Version: 0.1.64
3
+ Version: 0.1.66
4
4
  Summary:
5
5
  Author: Ray
6
6
  Author-email: ray@cruisys.com
@@ -11,8 +11,8 @@ internal/ext/amazon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
11
11
  internal/ext/amazon/aws/__init__.py,sha256=2YFjb-rHG1JaZGZiZffYDesgTAJjDshOqQbswOYzhP8,834
12
12
  internal/ext/amazon/aws/const.py,sha256=l4WMg5bKWujwOKABBkCO2zclNg3abnYOfbhD7DG8GsA,109
13
13
  internal/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- internal/http/requests.py,sha256=qRkDP23H8afC98Xx-P1CwDVeU_PUMEFbBEW6vuM6YcY,1290
15
- internal/http/responses.py,sha256=Xf1kk-lK8nDQoRQA_Yfu4TAU5EELWAyisyouJBj7ses,1953
14
+ internal/http/requests.py,sha256=Uof9HbxVBconKNENlZkkvYpCbcU7XzBHpUAk1RutALc,1401
15
+ internal/http/responses.py,sha256=_N9d1qVBOGySv4Kj1mEV8SntjcIXiX-W2Sz8T_fQoeQ,1566
16
16
  internal/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  internal/interface/base_interface.py,sha256=R5MmO5oa5-ORPV_adkegLVCwsVio2zFOuQFGiby3khs,340
18
18
  internal/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -21,6 +21,6 @@ internal/model/operate.py,sha256=Yuq7oyM2xmBy_X9021SgrpnpYQW6D_bgydI9PRFuQVQ,161
21
21
  internal/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  internal/schema/base_schema.py,sha256=PwMFPG1uNeO01wNxmamj9RlAfbPIYiQo3pduPywOg8w,435
23
23
  internal/utils.py,sha256=0SubS0iUhDvjSX1F4TykasA5-enYJzt2VH-f7_0BnjI,1509
24
- internal-0.1.64.dist-info/METADATA,sha256=kgtuMymri__YlyXJMa5_l3S4SLqF8rPOZ2pQcmo77h0,625
25
- internal-0.1.64.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
26
- internal-0.1.64.dist-info/RECORD,,
24
+ internal-0.1.66.dist-info/METADATA,sha256=dX_NsChgtsCptuzTE0guY7kKK0o_pDAa0ae3k07fIB0,625
25
+ internal-0.1.66.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
26
+ internal-0.1.66.dist-info/RECORD,,