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 http-file-streamer

Usage

Streamer

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

from http_file_streamer 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 http_file_streamer 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.1.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.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: http_file_streamer-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 9a312650deca297fecd95cf21d3cd8a58466264a24408dfc7ce34df4e655a8e9
MD5 6db56979d1ece29d221c6f72b426b706
BLAKE2b-256 8ce4489ac412b8d964eb048b7b96b5b462e06a0de01251aa30bfdbb0886f7b8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for http_file_streamer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a0f6e5f54d02adff90145fe7c4ac4db2d2b76dbfb85c8d68e8fa1ade25b2912
MD5 cf7c5407771b1073b6c5a7ffc199b0e7
BLAKE2b-256 f0c3162301b94bb33e4f381bc18c22ed172c6c4b58cb22759c411bff8619d44e

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