Python SDK for Openfiles API
Project description
Openfiles Python SDK
A Python SDK for interacting with the Openfiles API.
Installation
pip install openfiles
Usage
from openfiles import OpenfilesClient
# Method 1: Initialize the client with your API token
client = OpenfilesClient(api_token="your_api_token")
# Method 2: Initialize using OPENFILES_API_TOKEN environment variable
# export OPENFILES_API_TOKEN="your_api_token"
client = OpenfilesClient()
# Upload a file
response = client.upload_file(
file_path="test/file.txt", description="My file description"
)
file_bag_id = response.bag_id
print(f"File uploaded with bag_id: {file_bag_id}")
# Get user information
user_info = client.get_user_info()
print(f"Space left: {user_info.space_left} / {user_info.capacity}")
# List user files
files = client.get_user_files_list()
for file in files:
print(f"File: {file.filename}, Size: {file.size}, Bag ID: {file.bag_id}")
# Download a file
client.download_file(bag_id=file_bag_id, destination="test/file_copy.txt")
# Delete a file
client.delete_file(bag_id=file_bag_id)
Features
- Upload files
- Download files
- Delete files
- Get user information
- List user files
License
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
openfiles-1.1.1.tar.gz
(6.3 kB
view details)
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 openfiles-1.1.1.tar.gz.
File metadata
- Download URL: openfiles-1.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3971b35a4ecb9c162db5f192cfdc57c475c396c6f05e0048a354ce1f6c466f5
|
|
| MD5 |
c8438ec8d9074f180dbca00f5bb99663
|
|
| BLAKE2b-256 |
089ad1bc49252e8f12d1f5d38479c7445865d963e881b25f9a6a4040e7b29911
|
File details
Details for the file openfiles-1.1.1-py3-none-any.whl.
File metadata
- Download URL: openfiles-1.1.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b03ce5c04a5c6435193346edab16a5ee9347d85fec46d7314c2fdfd471f3f455
|
|
| MD5 |
2ec5e3b3c3da2d03777fa8dd2a0e338a
|
|
| BLAKE2b-256 |
3ba9aff83d2e251b64ca516bac8142bf663e9fa30eead2b0dfad518a81d84eb1
|