This commit is contained in:
2024-03-09 21:17:19 +02:00
parent 5c4997e137
commit aa518c6a97
6 changed files with 25 additions and 26 deletions

View File

@ -56,8 +56,10 @@ lint/black: ## check style with black
black src/api_client black src/api_client
lint/isort: ## check imports with isort lint/isort: ## check imports with isort
isort src/api_client isort src/api_client
lint/type: ## check imports with isort
mypy src/api_client
lint: lint/isort lint/black lint/flake8 ## check style lint: lint/isort lint/black lint/flake8 lint/type ## check style
test: ## run tests quickly with the default Python test: ## run tests quickly with the default Python
pytest -v pytest -v

View File

@ -56,7 +56,7 @@ message = "Bump version: {current_version} → {new_version}"
[[tool.bumpversion.files]] [[tool.bumpversion.files]]
filename = "src/sdlv_api_client/__init__.py" filename = "src/api_client/__init__.py"
[tool.black] [tool.black]
@ -64,9 +64,7 @@ line-length = 160
target-version = ['py311'] target-version = ['py311']
include = '\.pyi?$' include = '\.pyi?$'
extend-exclude = '''( extend-exclude = '''(
migrations/*
| .git/* | .git/*
| media/*
)''' )'''
workers = 4 workers = 4

View File

@ -1,21 +1,24 @@
## Requirements for development of library ## Requirements for development of library
# Base requirements # Base requirements
requests~=2.31.0 requests==2.31.0
pydantic~=2.6.3 pydantic==2.6.3
# Code style # Code style
black~=24.2 black==24.2
flake8~=7.0 flake8==7.0
isort~=5.13 isort==5.13.2
mypy~=1.9
# Type check
mypy==1.9
types-requests==2.31.0.20240218
# Version and package support # Version and package support
twine~=5.0 twine==5.0
bump-my-version~=0.18 bump-my-version==0.18.3
build~=1.1 build==1.1.1
pur~=7.3 pur==7.3.1
setuptools~=69.1 setuptools==69.1.1
# Testing and debugging # Testing and debugging
pytest~=8.0 pytest==8.1.1
ipython~=8.22.0 ipython==8.22.2

View File

@ -56,7 +56,7 @@ class BaseAPIClient(ABC):
prepared_request: requests.PreparedRequest = self._session.prepare_request(req) prepared_request: requests.PreparedRequest = self._session.prepare_request(req)
self._info( self._info(
f"Sending request with payload={prepared_request.body}", f"Sending request with payload={prepared_request.body!r}",
extra={"payload": shortify_log_value(kwargs.get("json", kwargs.get("data", {})))}, extra={"payload": shortify_log_value(kwargs.get("json", kwargs.get("data", {})))},
) )
response = self._session.send(prepared_request) response = self._session.send(prepared_request)
@ -68,7 +68,7 @@ class BaseAPIClient(ABC):
return response return response
def prepare_authentication(self, request: requests.Request) -> None: def prepare_authentication(self, request: requests.Request) -> None:
""" Do auth setup in-place """ """Do auth setup in-place"""
pass pass
def _info(self, msg: str, *args: Any, **kwargs: Any) -> None: def _info(self, msg: str, *args: Any, **kwargs: Any) -> None:

View File

@ -1,6 +1,3 @@
from .credentials import get_credential_token from .logging import get_logger
from .fast_api import do_init
from .http_handle import HTTPXClientWrapper
from .logging import get_logger, setup_logging
__all__ = ["get_logger", "setup_logging", "HTTPXClientWrapper", "do_init", "get_credential_token"] __all__ = ["get_logger"]

View File

@ -1,8 +1,7 @@
import datetime import datetime
import decimal import decimal
import json import json
import re from typing import Any
from typing import Any, NoReturn
from pydantic import BaseModel from pydantic import BaseModel