Skip to main content

lona-html5-qrcode

license MIT Python Version Latest Version

lona-html5-qrcode provides Html5-QRCode bindings for Lona

Demo

(This demo is available in test-script/test_script.py)

Installation

lona-html5-qrcode can be installed using pip

pip install lona lona-html5-qrcode

Usage

from lona.html import HTML, H1, Div
from lona import App, View

from lona_html5_qrcode.html import Html5QRCodeScanner

app = App(__file__)


@app.route('/')
class QRCodeView(View):
    def handle_scan_result(self, scanner, data):
        scanner.stop()
        self.result.set_text(f'{json.dumps(data)}\n')

    def handle_request(self, request):
        self.result = Div()

        return HTML(
            H1('QRCodeScanner'),
            self.result,
            Html5QRCodeScanner(
                handle_scan_result=self.handle_scan_result,
            ),
        )


app.run()

Arguments

Name Type Default Description
handle_scan_result Callable | None None Callback that gets called on every scan result. Gets called with a reference to the scanner node, and the scan data
config dict | None None html5-qrcode config. Default is available using Html5QRCodeScanner.get_default_config()
theme str '' CSS theme name
autostart bool False Start scanning on first render

Default html5-qrcode config

{
    'fps': 10,
    'qrbox': {
        'width': 100,
        'height': 100,
    },
    'rememberLastUsedCamera': True,
}

Themes

When theme is set, a CSS class named f'html5-qrcode-{theme}' gets added to Html5QRCodeScanner. This class then can be used for theming.

lona-html5-qrcode comes with a list of default themes builtin.

Name Description
picocss Better integration into lona-picocss

Properties

Name Type Description
handle_scan_result Callable | None Callback that gets called on every result. Gets called with a reference to the scanner node, and the scan data

Methods

Name Return Type Description
is_running() bool Check wether html5-qrcode is scanning
start() None Start html5-qrcode scanning
stop() None Stop html5-qrcode scanning
get_default_config() dict Returns the default config used for html5-qrcode

Troubleshooting

Camera access is only supported in secure context like https or localhost

Html5-QRCode uses the browser media API scan QR-Codes. The browser grants access to this API only in secure contexts. To get around this in development, use the Chrome flag unsafely-treat-insecure-origin-as-secure, like shown below.

Metadata

Release files for lona-html5-qrcode 0.1

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

Source distribution (sdist)

Source distribution for lona-html5-qrcode 0.1
File Size Uploaded Provenance
lona-html5-qrcode-0.1.tar.gz 119.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lona-html5-qrcode 0.1
File Interpreter ABI Platform
lona_html5_qrcode-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 238.7 kB

Release files / lona-html5-qrcode-0.1.tar.gz

Download URL lona-html5-qrcode-0.1.tar.gz
Size 119.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b410024874fcd739253434684cbf85e0bc389d19e2007f1616e0aa2b6d83852e
BLAKE2b-256 checksum
How to use checksums
685b5026d9f14c573ba2c6ea660b866ee2e6c9b2ec296cb9b763141790323a76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / lona_html5_qrcode-0.1-py3-none-any.whl

Download URL lona_html5_qrcode-0.1-py3-none-any.whl
Size 119.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d5db3f00d2ffb184073b2856987dad1e042f1f51bbd83372d32718b65974005
BLAKE2b-256 checksum
How to use checksums
a5afb46a43fd850f1c74682b597d4ad6eacda19c323f79b9b3c406562cc6b2e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Security for lona-html5-qrcode 0.1

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.1 This release

2 release files 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