Skip to main content

aqwebengine

Qt QWebEngine on async steroids:

  • async versions of methods to load URL and set page html
  • async versions of methods to get page content as HTML and plain text
  • async method to call python from JS
  • async method to call JS from Python

Uses qasync as an engine to run PyQt/PySide2 asyncronously.

Examples

w = AQWebEngine()
...
await w.set_html_async('<b>Hello</b>, world!')
...
await w.load('https://www.example.com')
...
html = await w.to_html_async()  # get current page as HTML
...
text = await w.to_plain_text()  # get current page as plain text
...
await w.eval_js('function inc(x) { return x + 1; }')
result = await w.eval_js('inc(41)')
assert result == 42
...
def do_something(x):
    return x + 1
w.register_python_function('do_something', do_something)
result = await w.eval_js('qt.callPython("do_something", 41)')
assert result == 42

Python API

eval_js

Asynchronously evaluates the string argument as a JS expression. Returns result to the Python caller. JSError is raised if evaluation of JS expression throws an exception.

register_python_function

Registeres a python (sync or async) function to be callable from JS (see qt.callPython JS API below).

Python function should take a single JSON-serializable parameter.

Arguments:

  • function_name - the name of the function, as seen by JS
  • function - python function. Can be sync or async, should take a single JSON-serializable argument.

JS API

qt.callPython

Calls python host.

Arguments:

  • function_name - the name of the registered python function
  • (optional) args - any JSON-serializable value

Python function may return JSON-serializable value, that will be returned to the JS caller.

Metadata

Release files for aqwebengine 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for aqwebengine 0.0.2
File Interpreter ABI Platform Actions
aqwebengine-0.0.2-py3-none-any.whl Python 3 none any Details for aqwebengine-0.0.2-py3-none-any.whl

Release files / aqwebengine-0.0.2-py3-none-any.whl

Download URL aqwebengine-0.0.2-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac7f7e23876a0415e1cccf4137921a50b935d32fe10051b72e4ee2c463ab00db
BLAKE2b-256 checksum
How to use checksums
70a037e6c026c70ce842d5aac398da3d9ad670904b6e8c2a8beaaf21861f22fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

Security for aqwebengine 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page