internal 0.1.33__tar.gz → 0.1.35__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.
- {internal-0.1.33 → internal-0.1.35}/PKG-INFO +1 -1
- {internal-0.1.33 → internal-0.1.35}/pyproject.toml +1 -1
- {internal-0.1.33 → internal-0.1.35}/src/internal/base_config.py +11 -0
- internal-0.1.35/src/internal/http/requests.py +23 -0
- internal-0.1.33/src/internal/http/requests.py +0 -12
- {internal-0.1.33 → internal-0.1.35}/README.md +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/base_factory.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/const.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/database.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/exception/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/exception/base_exception.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/exception/internal_exception.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/ext/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/ext/amazon/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/ext/amazon/aws/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/ext/amazon/aws/const.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/http/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/http/responses.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/interface/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/interface/base_interface.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/model/__init__.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/model/base_model.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/model/operate.py +0 -0
- {internal-0.1.33 → internal-0.1.35}/src/internal/utils.py +0 -0
|
@@ -26,5 +26,16 @@ class BaseConfig(BaseSettings):
|
|
|
26
26
|
DATABASE_URL: str = ""
|
|
27
27
|
DATABASE_NAME: str = ""
|
|
28
28
|
|
|
29
|
+
# Micro Service
|
|
30
|
+
AUTH_BASE_URL: str = ""
|
|
31
|
+
ORGANIZATION_BASE_URL: str = ""
|
|
32
|
+
CUSTOMER_BASE_URL: str = ""
|
|
33
|
+
CAR_BASE_URL: str = ""
|
|
34
|
+
RELATIONSHIP_MANAGEMENT_BASE_URL: str = ""
|
|
35
|
+
TICKET_BASE_URL: str = ""
|
|
36
|
+
NOTIFY_BASE_URL: str = ""
|
|
37
|
+
THIRD_PARTY_BASE_URL: str = ""
|
|
38
|
+
SCHEDULER_BASE_URL: str = ""
|
|
39
|
+
|
|
29
40
|
class Config:
|
|
30
41
|
case_sensitive = False
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
|
|
3
|
+
from fastapi import FastAPI
|
|
4
|
+
|
|
5
|
+
from ..exception.internal_exception import GatewayTimeoutException, BadGatewayException
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async def async_request(app: FastAPI, method, url, **kwargs):
|
|
9
|
+
timeout = httpx.Timeout(connect=app.state.config.REQUEST_CONN_TIMEOUT, read=app.state.config.REQUEST_READ_TIMEOUT,
|
|
10
|
+
write=app.state.config.REQUEST_WRITE_TIMEOUT, pool=app.state.config.REQUEST_POOL_TIMEOUT)
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
async with httpx.AsyncClient(timeout=timeout) as client:
|
|
14
|
+
response = await client.request(method, url, **kwargs)
|
|
15
|
+
return response
|
|
16
|
+
except httpx.TimeoutException as exc:
|
|
17
|
+
app.state.logger.error(
|
|
18
|
+
f"async_request(), TimeoutException, exc: {exc}, url: {url}, method: {method}, kwargs: {kwargs}")
|
|
19
|
+
raise GatewayTimeoutException()
|
|
20
|
+
except Exception as exc:
|
|
21
|
+
app.state.logger.error(
|
|
22
|
+
f"async_request(), Exception, exc: {exc}, url: {url}, method: {method}, kwargs: {kwargs}")
|
|
23
|
+
raise BadGatewayException()
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import httpx
|
|
2
|
-
|
|
3
|
-
from fastapi import FastAPI
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
async def async_request(app: FastAPI, method, url, **kwargs):
|
|
7
|
-
timeout = httpx.Timeout(connect=app.state.config.REQUEST_CONN_TIMEOUT, read=app.state.config.REQUEST_READ_TIMEOUT,
|
|
8
|
-
write=app.state.config.REQUEST_WRITE_TIMEOUT, pool=app.state.config.REQUEST_POOL_TIMEOUT)
|
|
9
|
-
|
|
10
|
-
async with httpx.AsyncClient(timeout=timeout) as client:
|
|
11
|
-
response = await client.request(method, url, **kwargs)
|
|
12
|
-
return response
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|