internal 0.1.64__tar.gz → 0.1.66__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.

Potentially problematic release.


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

Files changed (26) hide show
  1. {internal-0.1.64 → internal-0.1.66}/PKG-INFO +1 -1
  2. {internal-0.1.64 → internal-0.1.66}/pyproject.toml +1 -1
  3. {internal-0.1.64 → internal-0.1.66}/src/internal/http/requests.py +4 -4
  4. {internal-0.1.64 → internal-0.1.66}/src/internal/http/responses.py +3 -12
  5. {internal-0.1.64 → internal-0.1.66}/README.md +0 -0
  6. {internal-0.1.64 → internal-0.1.66}/src/internal/__init__.py +0 -0
  7. {internal-0.1.64 → internal-0.1.66}/src/internal/base_config.py +0 -0
  8. {internal-0.1.64 → internal-0.1.66}/src/internal/base_factory.py +0 -0
  9. {internal-0.1.64 → internal-0.1.66}/src/internal/const.py +0 -0
  10. {internal-0.1.64 → internal-0.1.66}/src/internal/database.py +0 -0
  11. {internal-0.1.64 → internal-0.1.66}/src/internal/exception/__init__.py +0 -0
  12. {internal-0.1.64 → internal-0.1.66}/src/internal/exception/base_exception.py +0 -0
  13. {internal-0.1.64 → internal-0.1.66}/src/internal/exception/internal_exception.py +0 -0
  14. {internal-0.1.64 → internal-0.1.66}/src/internal/ext/__init__.py +0 -0
  15. {internal-0.1.64 → internal-0.1.66}/src/internal/ext/amazon/__init__.py +0 -0
  16. {internal-0.1.64 → internal-0.1.66}/src/internal/ext/amazon/aws/__init__.py +0 -0
  17. {internal-0.1.64 → internal-0.1.66}/src/internal/ext/amazon/aws/const.py +0 -0
  18. {internal-0.1.64 → internal-0.1.66}/src/internal/http/__init__.py +0 -0
  19. {internal-0.1.64 → internal-0.1.66}/src/internal/interface/__init__.py +0 -0
  20. {internal-0.1.64 → internal-0.1.66}/src/internal/interface/base_interface.py +0 -0
  21. {internal-0.1.64 → internal-0.1.66}/src/internal/model/__init__.py +0 -0
  22. {internal-0.1.64 → internal-0.1.66}/src/internal/model/base_model.py +0 -0
  23. {internal-0.1.64 → internal-0.1.66}/src/internal/model/operate.py +0 -0
  24. {internal-0.1.64 → internal-0.1.66}/src/internal/schema/__init__.py +0 -0
  25. {internal-0.1.64 → internal-0.1.66}/src/internal/schema/base_schema.py +0 -0
  26. {internal-0.1.64 → internal-0.1.66}/src/internal/utils.py +0 -0
@@ -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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "internal"
3
- version = "0.1.64"
3
+ version = "0.1.66"
4
4
  description = ""
5
5
  authors = ["Ray <ray@cruisys.com>"]
6
6
  readme = "README.md"
@@ -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)
File without changes