Skip to main content

Interact with Pixeldrain using Python Synchronously and Asynchronously!

Project description

Pixeldrain Reloaded

This is a Python library for interacting with Pixeldrain, a simple file sharing service. It provides synchronous and asynchronous functions for uploading, downloading, and retrieving information about files on Pixeldrain; anonymously and with an API key.

Installation

pip install pixeldrain-reloaded

Documentation

get_info(file_id)

Get information about a file on Pixeldrain.

  • Parameters:

    • file_id (str): The ID of the file.
  • Returns:

    • dict: A dictionary containing file information.

upload_file(file_path, returns=None, filename=None, api_key=None)

Upload a file to Pixeldrain synchronously.

  • Parameters:

    • file_path (str): The path to the file to be uploaded.
    • returns (str, optional): Specifies what to return.
    • filename (str, optional): Name of the file to upload.
    • api_key (str, optional): Pixeldrain API key for authorized uploads.
  • Returns:

    • dict or str: Depending on the 'returns' parameter, returns a dictionary or a string.

download_file(file_id, path, filename=None)

Download a file from Pixeldrain synchronously.

  • Parameters:

    • file_id (str): The ID of the file or a Pixeldrain URL.
    • path (str): The local path to save the downloaded file.
    • filename (str, optional): Name to save the file as (default is Pixeldrain filename).
  • Returns:

    • str: The path to the downloaded file.

Asynchronous functions

The asynchronous version of the library provides the same functionality but is designed for use with asyncio and aiohttp for non-blocking asynchronous operations.

Usage

Synchronous Version

Import the library

import pixeldrain_reloaded as pixeldrain

Get Information about a File

file_info = pixeldrain.Sync.get_info(file_id="your_file_id")
print(file_info)

Upload a File

file_path = "path/to/your/file.txt"
response = pixeldrain.Sync.upload_file(file_path, returns="dict", filename="custom_filename", api_key="your_api_key")
print(response)

Download a File

file_id = "your_file_id"
download_path = "path/to/download"
downloaded_file = pixeldrain.Sync.download_file(file_id, download_path, filename="custom_filename")
print(f"File downloaded to: {downloaded_file}")

Asynchronous Version

Import the library

import pixeldrain_reloaded as pixeldrain

Get Information about a File (Async)

file_info = await pixeldrain.Async.get_info(file_id="your_file_id")
print(file_info)

Upload a File (Async)

file_path = "path/to/your/file.txt"
response = await pixeldrain.Async.upload_file(file_path, returns="dict", filename="custom_filename", api_key="your_api_key")
print(response)

Download a File (Async)

file_id = "your_file_id"
download_path = "path/to/download"
downloaded_file = await pixeldrain.Async.download_file(file_id, download_path, filename="custom_filename")
print(f"File downloaded to: {downloaded_file}")

Special Thanks

FayasNoushad for the original library

License

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

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

pixeldrain-reloaded-0.3.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

pixeldrain_reloaded-0.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file pixeldrain-reloaded-0.3.tar.gz.

File metadata

  • Download URL: pixeldrain-reloaded-0.3.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pixeldrain-reloaded-0.3.tar.gz
Algorithm Hash digest
SHA256 7ab61ac3c3db876b612f6513df472ead7499a8594ad49bc141b88dd74dbee853
MD5 717d8335b27bcbfb298be0c688d9224b
BLAKE2b-256 423104f570842145be3f4aacc0c7e95554a3a2b9fe89822541e26f3e80d5bc93

See more details on using hashes here.

File details

Details for the file pixeldrain_reloaded-0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pixeldrain_reloaded-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bb5ede85a678b9c234f2e75851bffa99559ae4660208c536082820c21ef3d074
MD5 7777e200f8fabf14769024938a8fef4f
BLAKE2b-256 9acbb0f08af1a3c99f786c64068ae5a2dd8f710214529a19a864201ee8c83ed2

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