Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Documentation for captcha #680

Merged
merged 4 commits into from
Nov 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve captcha documentation
rikroe committed Nov 23, 2024
commit ff44564b3a695d3af529bb5f64f529c1fb25e45e
24 changes: 14 additions & 10 deletions docs/source/captcha.rst
Original file line number Diff line number Diff line change
@@ -3,36 +3,38 @@ Using Captchas

The **first** login requires a captcha to be solved. Follow-up logins using refresh token do not require a captcha (if login data is persisted).

.. note::
The captcha token is only valid for a short time and can only be used once.
Getting a captcha token
------------------------

Depending on your region, you will need to solve a different captcha. Please select the appropriate region below.

- `North America <captcha/north_america.html>`_
- `Rest of World <captcha/rest_of_world.html>`_

.. note::
The captcha token is only valid for a short time and can only be used once.

Using the Python API
---------------------

When using the Python API, pass the token via the :code:`hcaptcha_token` argument when creating the account object.

.. warning::

Ensure to save the current :code:`MyBMWAccount` instance (or at least, the :code:`refresh_token` and :code:`gcid` attributes) to avoid having to solve the captcha again.

::

account = MyBMWAccount(USERNAME, PASSWORD, REGION, hcaptcha_token=HCAPTCHA_TOKEN)

.. warning::

Ensure to keep the current :code:`MyBMWAccount` instance in memory to avoid having to solve the captcha again.

For storing the data across restarts, an example implementation can be found in
`bimmerconnected.main() <https://github.com/bimmerconnected/bimmer_connected/blob/40ba148579da6b45268ea8ed9eb252cbafbe9042/bimmer_connected/cli.py#L328>`_
(with :code:`args.oauth_store` being a :code:`pathlib.Path()` object).

Using the CLI
-------------
When using the CLI, pass the token via the :code:`--captcha-token` argument (see `CLI documentation <cli.html#named-arguments>`_).

.. warning::

Please make sure to use the :code:`--oauth-store` (used by default) to avoid having to solve the captcha again.

::

bimmerconnected status --captcha-token CAPTCHA_TOKEN USERNAME PASSWORD REGION
@@ -43,4 +45,6 @@ After a successful login, the :code:`--captcha-token` parameter can be omitted (

bimmerconnected status USERNAME PASSWORD REGION

.. warning::

Please make sure to use the :code:`--oauth-store` (used by default) to avoid having to solve the captcha again.