Skip to main content

Fetchyr

RPA and authenticated browsing

1 min read


Fetchyr manages authenticated browser sessions for sites requiring login, MFA, or form automation.

login

session = client.fetchyr.login(
    url="https://example.com/login",
    credentials={"username": "user@example.com", "password": "secret"},
)
print(session.session_id, session.authenticated, session.artifact_id)

fetch (authenticated)

result = client.fetchyr.fetch(
    url="https://example.com/dashboard",
    session_id=session.session_id,
)
print(result.html, result.artifact_id)

detect_forms

forms = client.fetchyr.detect_forms(
    url="https://example.com/checkout",
    session_id=session.session_id,
)
for form in forms.forms:
    print(form.type, form.fields)

detect_mfa / submit_mfa

mfa = client.fetchyr.detect_mfa(session_id=session.session_id)
if mfa.mfa_required:
    result = client.fetchyr.submit_mfa(
        session_id=session.session_id,
        code="123456",
        mfa_type=mfa.mfa_type,
    )

create_workflow / execute_workflow

workflow = client.fetchyr.create_workflow(
    name="Login flow",
    steps=[
        {"action": "navigate", "url": "https://example.com/login"},
        {"action": "fill", "field": "username", "value": "{username}"},
        {"action": "fill", "field": "password", "value": "{password}"},
        {"action": "click", "selector": "button[type=submit]"},
    ],
)
result = client.fetchyr.execute_workflow(
    workflow_id=workflow.workflow_id,
    variables={"username": "user@example.com", "password": "secret"},
)

check_duplicates

result = client.fetchyr.check_duplicates(
    records=[{"id": "1", "url": "https://example.com/p/1"}],
    namespace="products",
)
print(result.duplicates, result.new_records)
Was this page helpful?