Metadata-Version: 2.4
Name: pyqt-hcaptcha
Version: 1.1.0
Summary: Modern hCaptcha SDK for PyQt applications
Author-email: Dolfies <me@dolfi.es>
License: The MIT License (MIT)
        
        Copyright (c) 2025-present Dolfies
        
        Permission is hereby granted, free of charge, to any person obtaining a
        copy of this software and associated documentation files (the "Software"),
        to deal in the Software without restriction, including without limitation
        the rights to use, copy, modify, merge, publish, distribute, sublicense,
        and/or sell copies of the Software, and to permit persons to whom the
        Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
        OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
        FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
        DEALINGS IN THE SOFTWARE.
        
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: X11 Applications :: Qt
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyqt6
Requires-Dist: pyqt6-webengine
Dynamic: license-file

# PyQtHCaptcha

**PyQtHCaptcha** is a Python library that provides a native hCaptcha widget for desktop applications using PyQt6.

![PyQtHCaptcha Demo](https://github.com/dolfies/pyqt-hcaptcha/raw/master/assets/demo.gif)

## Features

- Supports all configuration parameters of the native mobile SDK, including enterprise features like `rqdata` and custom endpoints
- Supports passive mode captchas with invisibles challenges
- Fully typed with modern Python type hints
- Works with `qasync` for seamless integration into async applications

## Installation

```bash
pip install pyqt-hcaptcha
```

## Usage

Injecting a hCaptcha widget into your PyQt application is straightforward. Below is a minimal example demonstrating how to set up the widget and connect to its signals:

```python
from PyQtHCaptcha import HCaptchaConfig, HCaptchaError, HCaptchaWebView

# Define your callbacks
def on_loaded():
    print("hCaptcha widget loaded successfully")

def on_success(token: str):
    print(f"Solution received: {token[:40]}...")

def on_failure(error: HCaptchaError):
    print(f"hCaptcha Error: {error.name}")

def on_expired():
    print("hCaptcha token expired")

# Create a configuration for the hCaptcha widget
config = HCaptchaConfig(
    sitekey="10000000-ffff-ffff-ffff-000000000001",
    url="https://accounts.hcaptcha.com/demo",
    theme="dark",
)

# Initialize the hCaptcha widget with the configuration
view = HCaptchaWebView(config)

# Connect signals to your callbacks
view.onLoaded.connect(on_loaded)
view.onSuccess.connect(on_success)
view.onFailure.connect(on_failure)
view.onExpired.connect(on_expired)

# Show the widget
view.setWindowTitle("hCaptcha Example")
view.resize(400, 600)
view.show()
```

See the `examples/` directory for more complete examples.

## Documentation

The documentation is available [here](https://pyqt-hcaptcha.rtfd.io/).
