Skip to main content

A package for streaming and receiving files.

Project description

HTTP FILE 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.3.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.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: http_file_streamer-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 7f07f62392c70f973e2965354b7ff4d7bf1ed590e5457a85105f91807a48c1c9
MD5 04c07b8680b2d86c8dea47bcece24cbb
BLAKE2b-256 538cf486063872c11380e143f820e2e75098b5898230cb7020ec5d8cfd63362f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for http_file_streamer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 acf6ac449f417f0fd6d19b1822498123fecf55572207434bb5d5cf4ca61ff35b
MD5 1facc5a346f216c8fc1c28b691b41cac
BLAKE2b-256 319c903125a94de3a7bab858084dcab780264f123d80dae72b5fce63dfb28a05

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