A Python wrapper and CLI for the Files.VC API, designed to upload, download, and manage files efficiently.
Project description
Files.VC Python Library
An Unofficial Python wrapper and CLI tool for the Files.VC API, designed to download, upload, and manage files efficiently.
Features
- Command-Line Interface (CLI) – Manage files directly from the terminal.
- Python Library – Easily embed
files_vcinto your Python programs. - Beautiful Output – Using the
tabulatelibrary, provides a well-formatted table for file information. - Progress Tracking – Shows real-time progress for uploads and downloads.
- Dynamic Progress Bar – In CLI mode, displays terminal size based progress bar with speed, remaining time, and elapsed time.
- Error Handling – Graceful handling of network failures and interruptions.
- Cross-Platform – Works on Windows, macOS, and Linux.
Installation
Install the package from PyPI:
python3 -m pip install Files-VC -U
Ensure you have Python 3.7 or later.
Using Files-VC as a Command Line Interface
Once installed, you can use the files-vc command to interact with the files.vc API.
files-vc --help
Use the -h/--help flag with any command to see the available options for that specific command.
file-vc <command> --help
Usage
files-vc <command> <positional_arguments> [options]
Available Commands & Arguments
- Common options:
-h/--help: Display help-v/--version: Display version information-t/--tablefmt: Set File info output format
- info: Get file information by file hash or URL
- list: List all files for a given account ID
- delete: Delete a file from the server
-a/--account_id: Specify the account ID that belongs to the file. (Required)
- check: Check if a file already exists on the server
- download/dl: Download a file using its hash or URL
-s/--save: Specify the folder path to save the downloaded file
- upload/ul: Upload a file to the server
-a/--account_id: Specify the account ID to upload the file
You can customize table output format using the -t/--tablefmt option, which supports formats like plain, grid, etc.
Check out the Tabulate README for a list of available formats and more details.
"This option must be used before the command."
files-vc --tablefmt grid <command> <args>
Examples
# Get file info
files-vc info <file_hash_or_url>
# List files for an account
files-vc list <account_id>
# Delete a file from the server
files-vc delete <file_hash_or_url> --account_id <account_id>
# Check if a file exists on the server
files-vc check /path/to/file
# Download a file (with optional save location)
files-vc download <file_hash_or_url> --save /path/to/save/location
# Upload a file (with optional account ID)
files-vc upload /path/to/file --account_id <account_id>
[!NOTE] After uploading, it may take a few seconds (depending on the file size) to display the file info, so please be patient. This is because the server takes some time to send a response.
Using Files-VC in Python Programs
You can also embed Files-VC directly into your Python code:
from files_vc import FilesVC
files_vc = FilesVC()
# Get file info
file_info = files_vc.get_file_info(file_hash="your_file_hash")
print(file_info.name, file_info.size)
# List files
files = files_vc.list_files(account_id="your_account_id")
for file in files:
print(file.name, file.download_url)
# Delete a file
message = files_vc.delete_file(file_hash="your_file_hash", account_id="your_account_id")
print(message)
# Check if a file exists
file_info = files_vc.check_file(file_path="/path/to/file")
print(file_info)
# Upload a file
message, file_info = files_vc.upload_file("/path/to/file", account_id="your_account_id")
print(message, file_info.view_url)
# Download a file
downloaded_path = files_vc.download_file(file_hash="your_file_hash", save_path="/path/to/save")
print(f"File saved at {downloaded_path}")
[!TIP] Always verify if the file already exists on the server using the
FilesVC().check_file(file_path}function before uploading it. This will reduce unwanted bandwidth usage. Check the __main__.py file for reference/ideas.
API Reference
Each class and function includes a docstring. For more details, refer to it.
FilesVC
The core class for interacting with the files.vc API.
Methods
get_file_info(file_hash: str, ...) -> FileInfo: Get information about a file. (Docstring)list_files(account_id: str) -> list[FileInfo]: Retrieve a list of files for an account. (Docstring)delete_file(file_hash: str, account_id: str, ...) -> str: Delete a file from the server. (Docstring)check_file(file_path: str, ...) -> FileInfo | None: Check if a file already exists on the server. (Docstring)download_file(file_hash: str, save_path: str, ...) -> str: Download a file by hash. (Docstring)upload_file(file_path: str, account_id: str, ...) -> tuple[str, FileInfo]: Upload a file to the server. (Docstring)
[!TIP] The
check_file,download_file, andupload_filefunctions includeprogressandprogress_argsparameters, which allow you to customize the progress. Check the __main__.py file for reference/ideas.
FileInfo
Represents metadata for a file.
name: File namefile_hash: MD5 hash of the filesize: File size in bytesupload_time: Time the file was uploadedmime_type: File's MIME typedownload_count: Number of downloadsview_url: URL to view the filedownload_url: URL to download the fileexpiration_time: Expiration time (if any)
Exception
FilesVCException: Custom exception for handling errors related to files.vc API operations.HTTPError: Exception raised when there is an HTTP error. (Same as requests.exceptions.HTTPError)- And other exceptions from the requests library.
TODO
- Creating tests – Unit and integration tests for core functions.
- Creating documentation – Generate API documentation for better developer experience.
Contributing
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
With ❤️ Made By @Sasivarnasarma
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file files_vc-1.0.2.tar.gz.
File metadata
- Download URL: files_vc-1.0.2.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
417bb923f19fdfbe19d3953e3f3c0fa0a0b81c4035b1559a92b4a2e15ce1eaac
|
|
| MD5 |
1b2add12edcd2e20acc9d1fe22bd5a94
|
|
| BLAKE2b-256 |
b21dd8c518ee53f6a382c04c7770bafe5afd94dc7f3bef364abca25655ba2c1d
|
Provenance
The following attestation bundles were made for files_vc-1.0.2.tar.gz:
Publisher:
python-publish.yml on Sasivarnasarma/Files-VC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
files_vc-1.0.2.tar.gz -
Subject digest:
417bb923f19fdfbe19d3953e3f3c0fa0a0b81c4035b1559a92b4a2e15ce1eaac - Sigstore transparency entry: 183031538
- Sigstore integration time:
-
Permalink:
Sasivarnasarma/Files-VC@8950b379a955cd0f4f34d74ef9ee37456e933d99 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/Sasivarnasarma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8950b379a955cd0f4f34d74ef9ee37456e933d99 -
Trigger Event:
release
-
Statement type:
File details
Details for the file files_vc-1.0.2-py3-none-any.whl.
File metadata
- Download URL: files_vc-1.0.2-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e1ce2b7cdfdea5142bb3f5c7ed15b7d87a9564d4e8c95aae7173df7b3678374
|
|
| MD5 |
8d52e0ed24dabea4b651f60b53d58658
|
|
| BLAKE2b-256 |
e26e5552557dcff56daa2cc654f8a0b7d5fbad44635cfa6b03625aa41aab2720
|
Provenance
The following attestation bundles were made for files_vc-1.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on Sasivarnasarma/Files-VC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
files_vc-1.0.2-py3-none-any.whl -
Subject digest:
2e1ce2b7cdfdea5142bb3f5c7ed15b7d87a9564d4e8c95aae7173df7b3678374 - Sigstore transparency entry: 183031540
- Sigstore integration time:
-
Permalink:
Sasivarnasarma/Files-VC@8950b379a955cd0f4f34d74ef9ee37456e933d99 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/Sasivarnasarma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8950b379a955cd0f4f34d74ef9ee37456e933d99 -
Trigger Event:
release
-
Statement type: