Skip to main content

waifuVault Python API module

Project description

waifuvault-python-api

This contains the official API bindings for uploading, deleting and obtaining files with waifuvault.moe. Contains a full up to date API for interacting with the service

Installation

pip install waifuvault

Usage

This API contains 4 interactions:

  1. Upload
  2. Delete
  3. Get file info
  4. Get file

The package is namespaced to waifuvault, so to import it, simply:

import waifuvault

Upload File

To Upload a file, use the upload_file function. This function takes the following options as an object:

Option Type Description Required Extra info
target string The target to upload can be URL or filename true URL or file path
expires string A string containing a number and a unit (1d = 1day) false Valid units are m, h and d
hideFilename boolean If true, then the uploaded filename won't appear in the URL false Defaults to false
password string If set, then the uploaded file will be encrypted false

Using a URL:

import waifuvault
upload_file = waifuvault.FileUpload("https://waifuvault.moe/assets/custom/images/08.png")
upload_res = waifuvault.upload_file(upload_file)
print(f"{upload_res.url}")

Using a a file path:

import waifuvault
upload_file = waifuvault.FileUpload("./files/aCoolFile.png")
upload_res = waifuvault.upload_file(upload_file)
print(f"{upload_res.url}")

File Info

If you have a token from your upload. Then you can get file info. This results in the following info:

  • token
  • url
  • protected
  • retentionPeriod

Use the file_info function. This function takes the following options as parameters:

Option Type Description Required Extra info
token string The token of the upload true
formatted boolean If you want the retentionPeriod to be human-readable or an epoch false defaults to false
import waifuvault
upload_info = waifuvault.file_info(your_token,False)
print(upload_info.retentionPeriod)
print(upload_info.url)

Human-readable timestamp:

import waifuvault
upload_info = waifuvault.file_info(your_token,True)
print(upload_info.retentionPeriod)
print(upload_info.url)

Delete File

To delete a file, you must supply your token to the delete_file function.

This function takes the following options as parameters:

Option Type Description Required Extra info
token string The token of the file you wish to delete true
import waifuvault
del_file = waifuvault.delete_file(your_token)
print(del_file)

Get File

This lib also supports obtaining a file from the API as a Buffer by supplying either the token or the unique identifier of the file (epoch/filename).

Use the get_file function. This function takes the following options an object:

Option Type Description Required Extra info
token string The token of the file you want to download true only if filename is not set if filename is set, then this can not be used
url string The URL of the file true only if token is not set if token is set, then this can not be used

Password is provided as a parameter on the call.

Important! The Unique identifier filename is the epoch/filename only if the file uploaded did not have a hidden filename, if it did, then it's just the epoch. For example: 1710111505084/08.png is the Unique identifier for a standard upload of a file called 08.png, if this was uploaded with hidden filename, then it would be 1710111505084.png

Obtain an encrypted file

import waifuvault
upload_enc_res = FileResponse(your_token,None,False,None)
file_enc_down = waifuvault.get_file(upload_enc_res,"your_password")
print(file_enc_down.__sizeof__())

Obtain a file from URL

import waifuvault
upload_enc_res = FileResponse(None,your_url,False,None)
file_enc_down = waifuvault.get_file(upload_enc_res,"your_password")
print(file_enc_down.__sizeof__())

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

waifuvault-1.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

waifuvault-1.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file waifuvault-1.1.0.tar.gz.

File metadata

  • Download URL: waifuvault-1.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for waifuvault-1.1.0.tar.gz
Algorithm Hash digest
SHA256 04b161483af235f318714cfd92a11c97ef4b76844f056a42564e13f770cecaa4
MD5 b63c21333cdda3858b3f762818efef07
BLAKE2b-256 0a5c3d9d2a1eabe8284b09c6d1fc83bd5be867d1c7c2151f4793f432d3957cda

See more details on using hashes here.

File details

Details for the file waifuvault-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: waifuvault-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for waifuvault-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71f008433232b68632da4b94f7df80236a2f8953a2ae379a5a7abd68c4d6debe
MD5 f25142b2da2b5c9d3b1a3849b044c149
BLAKE2b-256 67f0e3338b012620acf8b61b5860d1582d65f916a85b2f90067758b096fe7839

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page