Skip to content

docs: explain browser impersonation helpers - #472

Merged
kaifcodec merged 2 commits into
kaifcodec:mainfrom
w3lld1:docs/impersonate-helpers
Jul 30, 2026
Merged

docs: explain browser impersonation helpers#472
kaifcodec merged 2 commits into
kaifcodec:mainfrom
w3lld1:docs/impersonate-helpers

Conversation

@w3lld1

@w3lld1 w3lld1 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Document when to use impersonate_validate instead of generic_validate
  • Explain warmup_url, impersonate, and show_url
  • Add a usage example and note when impersonate_request is useful for multi-step flows

Validation

  • git diff --check
  • Documentation assertions against the live helper signatures
  • Python syntax validation for the new example

The full test and lint suites were not run locally because the dependency environment could not be installed within the available disk quota; I deferred them to CI because this change only updates documentation.

Fixes #464

@kaifcodec
kaifcodec requested a review from VamatoHD July 27, 2026 17:49

@brunolm brunolm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Document allow_redirects (default False) and the httpx name difference (follow_redirects vs allow_redirects).
- `allow_redirects` defaults to `False` (curl_cffi). This is the opposite of httpx’s `follow_redirects=True` used with `generic_validate`; pass `allow_redirects=True` when the profile URL redirects. Extra kwargs are forwarded to `impersonate_request`.
  1. Example taken check is too weak (user in response.text); align with CRITICAL rule 1.
    def process(response):
        if response.status_code == 404 and "User does not exist" in response.text:
            return Result.available()
        if response.status_code == 200 and f'profile/{user}' in response.text:
            # Prefer a unique body marker (title, canonical, embedded user id) —
            # not a bare `user in response.text` check (boilerplate false positives).
            return Result.taken()
        return Result.error(f"Unexpected response status: {response.status_code}")
@w3lld1

w3lld1 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — addressed both documentation points in 542e350:

  • documented that allow_redirects defaults to False, contrasted it with httpx's follow_redirects, and noted that additional keyword arguments are forwarded;
  • strengthened the example so both available and taken results require explicit, state-specific body markers.

Fresh validation: focused documentation assertions and git diff HEAD^ --check.

@kaifcodec
kaifcodec requested a review from brunolm July 30, 2026 02:58
@kaifcodec
kaifcodec removed the request for review from VamatoHD July 30, 2026 15:27

@kaifcodec kaifcodec left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thank you @w3lld1 for the contribution.
Feel free to explore the project and contribute further.

@kaifcodec
kaifcodec merged commit 5db7d5a into kaifcodec:main Jul 30, 2026
2 checks passed
@kaifcodec kaifcodec added the documentation Improvements or additions to documentation label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

3 participants