Skip to main content

Python module to, stream videos via authenticated sessions using FastAPI

Project description

Deployments

book pypi none-shall-pass

PyPI version shields.io Pypi-format Pypi-status

PyStream

Python module to, stream videos via authenticated sessions using FastAPI

Install

pip install stream-localhost

Sample Usage

import asyncio
import os
import pystream

if __name__ == '__main__':
    kwargs = dict(
        authorization={"Alan Turing": "Pr0gRamM1ng", "Linus Torvalds": "LinuxOS"},
        video_source=os.path.join(os.path.expanduser('~'), 'Downloads')
    )
    # Add the following to host on local IP address, skip for localhost (127.0.0.1)
    # kwargs["video_host"] = pystream.utils.get_local_ip()
    asyncio.run(pystream.start(**kwargs))

Env Variables

:bulb:   Environment variables can (optionally) be loaded from any plain text file.
Refer the wiki page for more information.

Mandatory

  • AUTHORIZATION: Dictionary of key-value pairs with username as key and password as value.
  • VIDEO_SOURCE: Source path for video files.

:bulb:   Files starting with _ (underscore) and . (dot) will be ignored

Optional

  • VIDEO_HOST: IP address to host the video. Defaults to 127.0.0.1
  • VIDEO_PORT: Port number to host the application. Defaults to 8000
  • FILE_FORMATS: Sequence of supported video file formats. Defaults to (.mp4, .mov)
  • WORKERS: Number of workers to spin up the uvicorn server. Defaults to 1
  • WEBSITES: List of websites (supports regex) to add to CORS configuration. Required only if tunneled via CDN
  • AUTO_THUMBNAIL: Boolean flag to auto generate thumbnail images for preview. Defaults to True
  • KEY_FILE: Path to the private key file for SSL certificate. Defaults to None
  • CERT_FILE: Path to the full chain file for SSL certificate. Defaults to None
  • SECURE_SESSION: Boolean flag to secure the cookie session_token. Defaults to False

:bulb:   If SECURE_SESSION to set to true, the cookie session_token will only be sent via HTTPS
This means that the server can ONLY be hosted via HTTPS or localhost

Coding Standards

Docstring format: Google
Styling conventions: PEP 8 and isort

Release Notes

Requirement

pip install gitverse

Usage

gitverse-release reverse -f release_notes.rst -t 'Release Notes'

Linting

pre-commit will ensure linting, run pytest, generate runbook & release notes, and validate hyperlinks in ALL markdown files (including Wiki pages)

Requirement

pip install sphinx==5.1.1 pre-commit recommonmark

Usage

pre-commit run --all-files

Pypi Package

pypi-module

https://pypi.org/project/stream-localhost/

Runbook

made-with-sphinx-doc

https://thevickypedia.github.io/PyStream/

License & copyright

© Vignesh Rao

Licensed under the MIT License

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

stream_localhost-2.1-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file stream_localhost-2.1-py3-none-any.whl.

File metadata

  • Download URL: stream_localhost-2.1-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for stream_localhost-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ed6ecce6f97e99c347bf4c9a7955b177c0bf4ea1590f933fc88dddde638b7fb
MD5 d87a1484bbacd5719e31d2afb6e668bc
BLAKE2b-256 85ff09458c782c3e0b6d64bc75813a8766b20ac0a0f339b999027cd7b64e036f

See more details on using hashes here.

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