add PYTHONPATH environment variable to Dockerfile
This commit is contained in:
22
src/app/lib/base_client/httpx_client.py
Normal file
22
src/app/lib/base_client/httpx_client.py
Normal file
@ -0,0 +1,22 @@
|
||||
from abc import ABC
|
||||
from typing import Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from .client import BaseClient
|
||||
|
||||
|
||||
class HTTPXClient(BaseClient, ABC):
|
||||
async def _method(self, method: str, path: str, data: Optional[dict] = None, params: Optional[dict] = None) -> dict:
|
||||
async with httpx.AsyncClient() as client:
|
||||
url = self.base_url + path
|
||||
headers = self.headers
|
||||
request = client.build_request(
|
||||
method,
|
||||
url,
|
||||
json=data,
|
||||
params=params,
|
||||
headers=headers
|
||||
)
|
||||
response = await client.send(request)
|
||||
return response.json()
|
||||
Reference in New Issue
Block a user