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
lint/isort: ## check imports with isort
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
pytest -v

View File

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

View File

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

View File

@ -56,7 +56,7 @@ class BaseAPIClient(ABC):
prepared_request: requests.PreparedRequest = self._session.prepare_request(req)
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", {})))},
)
response = self._session.send(prepared_request)
@ -68,7 +68,7 @@ class BaseAPIClient(ABC):
return response
def prepare_authentication(self, request: requests.Request) -> None:
""" Do auth setup in-place """
"""Do auth setup in-place"""
pass
def _info(self, msg: str, *args: Any, **kwargs: Any) -> None:

View File

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

View File

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