Skip to content

Error while authenticating #52

Description

@adam-sikora

I have encountered an error while authenticating CapellaConsoleClient. A lot of clients were initiated simultaneously from separate machines so it might be potentially connected to some rate limiting. Most of the authentications passed fine but some of them failed.

Relevant part of the traceback:

  File "/usr/local/lib/python3.11/dist-packages/capella_console_client/client.py", line 83, in __init__
    self._sesh.authenticate(email, password, token, no_token_check)
  File "/usr/local/lib/python3.11/dist-packages/capella_console_client/session.py", line 64, in authenticate
    self._basic_auth(email, password)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/capella_console_client/session.py", line 113, in _basic_auth
    resp = self.post("/token", headers={"Authorization": f"Basic {basic_token}"})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/httpx/_client.py", line 1136, in post
    return self.request(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/httpx/_client.py", line 821, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/capella_console_client/session.py", line 146, in send
    ret = super().send(*fct_args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/httpx/_client.py", line 908, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/httpx/_client.py", line 936, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/httpx/_client.py", line 993, in _send_handling_redirects
    raise exc
  File "/usr/local/lib/python3.11/dist-packages/httpx/_client.py", line 976, in _send_handling_redirects
    hook(response)
  File "/usr/local/lib/python3.11/dist-packages/capella_console_client/hooks.py", line 26, in translate_error_to_exception
    handle_error_response_and_raise(response)
  File "/usr/local/lib/python3.11/dist-packages/capella_console_client/exceptions.py", line 94, in handle_error_response_and_raise
    error = response.json()
            ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/httpx/_models.py", line 755, in json
    return jsonlib.loads(self.content.decode(encoding), **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions