Skip to main content

A Python package for creating simple local web overlays for streams and other needs

Project description

pyweboverlay

A Python package for easily creating web overlays in Python using Flask and SocketIO.

Installation

pip install pyweboverlay

Usage

Set up your directory structure like the example provided in the repository:

│   example.py
│
└───rloverlay
    │   rloverlay.html
    │
    └───static
            background.png
            pivot.png

See example.py and the rloverlay/ directory for a complete working example.

image

API Reference

pyweboverlay.init(port=5000, verbose=True)

Initialize the pyweboverlay server.

  • port (int): Port number for the web server (default: 5000)
  • verbose (bool): Enable detailed logging (default: True)

pyweboverlay.register(overlay, name, template_file=None, static_dir=None)

Register an overlay instance with the server.

  • overlay (Overlay): Instance of a class extending Overlay
  • name (str): Unique name for the overlay's namespace
  • template_file (str, optional): Path to custom HTML template file
  • static_dir (str, optional): Path to directory for serving static files

Returns the overlay ID.

pyweboverlay.update(name, data=None)

Update an overlay with new data and emit to connected clients.

  • name (str): The registered name of the overlay
  • data (any): Data to pass to the overlay's update method

Creating Custom Overlays

Extend the Overlay base class and implement two required methods:

from pyweboverlay import Overlay

class CustomOverlay(Overlay):
    def get_data(self):
        """Return current overlay data as a dictionary."""
        return {"key": "value"}
    
    def update(self, data=None):
        """Update the overlay state with new data."""
        if data is not None:
            # Process and store the data
            pass

Features

  • Real-time updates using WebSocket connections
  • Custom HTML templates with Jinja2 templating
  • Static file serving for images, CSS, and JavaScript
  • Multiple overlays on a single server
  • Minimal configuration required

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyweboverlay-1.0.6.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyweboverlay-1.0.6-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file pyweboverlay-1.0.6.tar.gz.

File metadata

  • Download URL: pyweboverlay-1.0.6.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyweboverlay-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d301a9be567821cba7655657e3a6e05408b909c146371f26cacbe418b39ee672
MD5 9f173c64eb8274673dff3eb49b91aaa6
BLAKE2b-256 c6779389a6e21b4c6b43521bb75bbd64f3a6162e9b1b085e58b2bf8cbb1a6ee5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyweboverlay-1.0.6.tar.gz:

Publisher: workflow.yml on chrisrca/pyweboverlay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyweboverlay-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyweboverlay-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyweboverlay-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 adce770ec3bee30742f9bd1642be6415ffac43ab84bd1437b3baa32357d1c354
MD5 f6ff179cb6a89eb21a70dc3b10449996
BLAKE2b-256 82a2034442da870d149ec230d29ce50ad6d9621d54081b4d94ed55cb4983db5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyweboverlay-1.0.6-py3-none-any.whl:

Publisher: workflow.yml on chrisrca/pyweboverlay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page