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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyweboverlay-1.0.5.tar.gz
  • Upload date:
  • Size: 6.4 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.5.tar.gz
Algorithm Hash digest
SHA256 f6f164e5dd005d79c2384ba19c2c810f286f514b2034e6f5d41f2a563f5d13a6
MD5 a21ea371eccc981fd671b079d1ab76a1
BLAKE2b-256 e9f5fd89ea6c821ba3c7f4138d119cc2fb0d7c0380b89efdff6c09a5f79e8aef

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyweboverlay-1.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 74d114d7491a555759eda1bac53d168c6fd67fd29c9835d9ff04eb8e389e4159
MD5 3be9d7bd968fdebbd3ba9b1f27f5a8ff
BLAKE2b-256 519a52dcf761be063e17d2f7c48c3b70b4dda711432d373594dfd450fb0f1b2c

See more details on using hashes here.

Provenance

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