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.2.tar.gz (4.8 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.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: http_file_streamer-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 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.2.tar.gz
Algorithm Hash digest
SHA256 a7b67193e7a09961620eda915ec104da27cb85c293610ef0866de2bc6c669a7b
MD5 e887302adb0ba97bfed885ec076cb530
BLAKE2b-256 46b4f81bfb0fbca12f84246585a5aa26ca56889b6efef60b159df1c4c0bd4354

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for http_file_streamer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a4cb40c24dac30f5f27220758c2ee9c7d5d050a34d10353b30ba5aea165b92e
MD5 744779e94edada83226715462089c44a
BLAKE2b-256 893da0ed7034cbedc57fa70b7500c30761f654549e01bedbc192d71d939b2174

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