Add first version of the client auth for sdk #80
main.yaml
on: push
Annotations
15 errors and 4 warnings
pydocstyle
Process completed with exit code 1.
|
datacosmos/client.py#L8
from config.config import Config
class DatacosmosClient:
- def __init__(self, config: Optional[Config] = None, config_file: str = "config/config.yaml"):
+ def __init__(
+ self, config: Optional[Config] = None, config_file: str = "config/config.yaml"
+ ):
self.config = config or self._load_config(config_file)
self.token = None
self.token_expiry = None
self._http_client = self._authenticate_and_initialize_client()
|
datacosmos/client.py#L32
client_secret=self.config.client_secret,
audience=self.config.audience,
)
self.token = token_response["access_token"]
- self.token_expiry = datetime.now(timezone.utc) + timedelta(seconds=token_response.get("expires_in", 3600))
+ self.token_expiry = datetime.now(timezone.utc) + timedelta(
+ seconds=token_response.get("expires_in", 3600)
+ )
# Initialize the HTTP session with the Authorization header
http_client = requests.Session()
http_client.headers.update({"Authorization": f"Bearer {self.token}"})
|
datacosmos/client.py#L55
"""
self._refresh_token_if_needed()
return self._http_client
# Proxy HTTP methods to the underlying authenticated session
- def request(self, method: str, url: str, *args: Any, **kwargs: Any) -> requests.Response:
+ def request(
+ self, method: str, url: str, *args: Any, **kwargs: Any
+ ) -> requests.Response:
"""
Proxy method to send HTTP requests using the authenticated session.
"""
self._refresh_token_if_needed()
return self._http_client.request(method, url, *args, **kwargs)
|
build/lib/datacosmos/client.py#L13
Line too long (97 > 79 characters) (E501)
|
build/lib/datacosmos/client.py#L37
Line too long (114 > 79 characters) (E501)
|
build/lib/datacosmos/client.py#L54
Line too long (81 > 79 characters) (E501)
|
build/lib/datacosmos/client.py#L60
Line too long (93 > 79 characters) (E501)
|
datacosmos/client.py#L13
Line too long (97 > 79 characters) (E501)
|
datacosmos/client.py#L37
Line too long (114 > 79 characters) (E501)
|
datacosmos/client.py#L54
Line too long (81 > 79 characters) (E501)
|
datacosmos/client.py#L60
Line too long (93 > 79 characters) (E501)
|
cognitive
Process completed with exit code 1.
|
lint
Linting failures detected. See check runs with annotations for details.
|
isort
Process completed with exit code 1.
|
pydocstyle
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
cognitive
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
lint
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
bandit
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|