Skip to main content

A package for streaming and receiving files.

Project description

My Streamer Package

A Python package for streaming and receiving files with additional metadata.

Features

  • Stream files to a specified URL.
  • Receive files and save them locally or in memory.
  • Supports metadata in the headers.
  • Configurable logging.

Installation

You can install the package using pip:

pip install my_streamer_package

Usage

Streamer

The Streamer class is used to stream files to a specified URL.

from src import Streamer
import logging

url = "http://example.com/upload"
file_path = "/path/to/your/file.txt"
metadata = {"key1": "value1", "key2": "value2"}

streamer = Streamer(url, file_path, metadata=metadata, logging_level=logging.INFO)
streamer.start()

# To stop streaming
streamer.stop()

Receiver

The Receiver class is used to receive files from a stream.

from src import Receiver
import logging

headers = {"X-Metadata-key1": "value1", "X-Metadata-key2": "value2"}
stream = some_stream_source()  # This should be an iterable yielding byte chunks

receiver = Receiver(headers, stream, save_path="/path/to/save/file.txt", logging_level=logging.INFO)

# Get metadata
metadata = receiver.get_metadata()

# Check if streaming is ongoing
is_streaming = receiver.is_streaming()

# Get the length of the received content
content_length = receiver.get_content_length()

# Get the received file data
file_data = receiver.get_file_data()

License

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

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Author

Babak Zarrinbal

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

http_file_streamer-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

http_file_streamer-0.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file http_file_streamer-0.1.0.tar.gz.

File metadata

  • Download URL: http_file_streamer-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for http_file_streamer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 42f1ace842edc60f7893a77ecb1ba2b7a74ab2d481caf49d91a079ad501a864f
MD5 1f4b7e915bcf24c75c8d4676f5c7d2e1
BLAKE2b-256 e7e9e7c2cc094deb89668e36a75dfaea4f26244574cb0fd6442db3e52fadef3d

See more details on using hashes here.

File details

Details for the file http_file_streamer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for http_file_streamer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94eaaafa7609c1cde62038bef4e7cfee7cb22603f83b1f8d1335feb0f240d9ad
MD5 dab840a92800bbf917ebd4f76e2c1291
BLAKE2b-256 1d67c2e5e056d990e7ecbd09337f8d36dc1980c24749a4b4860b8be47e490e2c

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