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.core 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.4.tar.gz (6.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.4-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyweboverlay-1.0.4.tar.gz
  • Upload date:
  • Size: 6.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.4.tar.gz
Algorithm Hash digest
SHA256 bc1428f79e171f40675b6e5a2d5443c3a4d84e2b89e56b1a3beea87dac986e72
MD5 2eb89b4ded15f443fbc6aa0c4a1eb3c9
BLAKE2b-256 aab72d3c5c3d4b00c1a1d78353591288d05ef531f6b03031a0765c00fb3babf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyweboverlay-1.0.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: pyweboverlay-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 23952260532cab78cb3ca29b9d9265bbbfbbe0a54403b7ee96b74d8b220c9b64
MD5 d4fbf86a4192a85362f50c8a63ca1c46
BLAKE2b-256 9bab70a2ab8485a16224d6ce751dd1757768a5e9f9ecee77504e0ba6751a7e24

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyweboverlay-1.0.4-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