Skip to main content

A Telegram bot that can stream Telegram files to users over HTTP.

Reason this release was yanked:

Forgot to test before releasing

Project description

tgfilestream

A Telegram bot that can stream Telegram files to users over HTTP.

Setup

Install tgfilestream package

pip install tgfilestream

Create a text file to store environment variables example (secrets.env):

TG_API_ID=1234567
TG_API_HASH=66a73ed2f8a80f52488dfdb3b128bae6
HOST=127.0.0.1
PORT=8080
PUBLIC_URL=http://127.0.0.1:8080
TG_BOT_FATHER_TOKEN=1234567890:b93dcfa3120fa82350e2bc72df83380e

Start the bot and server using the following command

tgfilestream --env [path to the text file]

example:

tgfilestream --env secrets.env

Note

A reverse proxy is recommended to add TLS. When using a reverse proxy, keep HOST as-is, but add the publicly accessible URL to PUBLIC_URL. The URL should include the protocol, e.g. https://example.com.

Environment variables

  • TG_API_ID (required) - Your Telegram API ID.
  • TG_API_HASH (required) - Your Telegram API hash.
  • TG_BOT_TOKEN (required) - Your Telegram Bot Token.
  • TG_SESSION_NAME (defaults to tgfilestream) - The name of the Telethon session file to use.
  • PORT (defaults to 8080) - The port to listen at.
  • HOST (defaults to localhost) - The host to listen at.
  • PUBLIC_URL (defaults to http://localhost:8080) - The prefix for links that the bot gives.
  • TRUST_FORWARD_HEADERS (defaults to false) - Whether or not to trust X-Forwarded-For headers when logging requests.
  • DEBUG (defaults to false) - Whether or not to enable extra prints.
  • LOG_CONFIG - Path to a Python basic log config. Overrides DEBUG.
  • REQUEST_LIMIT (default 5) - The maximum number of requests a single IP can have active at a time.
  • CONNECTION_LIMIT (default 20) - The maximum number of connections to a single Telegram datacenter.
  • CACHE_SIZE (defaults to 128) - The number of FileInfo objects (messages) to cache.

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

tgfilestream-0.1.3.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

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

tgfilestream-0.1.3-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file tgfilestream-0.1.3.tar.gz.

File metadata

  • Download URL: tgfilestream-0.1.3.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tgfilestream-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ea5ab74794a9267d399214d18802e1764bbfb6bd3272048c650154a537cd0084
MD5 f208e174c8fce4c2c15e43f1f8341f5c
BLAKE2b-256 3d871bee4eb9cd3761f9a577ae2b76ad326361f5e347c5c60a6631922b9e2b96

See more details on using hashes here.

File details

Details for the file tgfilestream-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tgfilestream-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tgfilestream-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9cc0f1415965631019f91b7e108058bc5bcfca58b6d0b551e7cee15b8d6653a7
MD5 42b001942c3705e7abbcf84712e36255
BLAKE2b-256 93a32a531f31ae70cb21482492b6f8e25de2e6262b3d9ff405ee55342237765d

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