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.0.tar.gz
(5.4 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.0.tar.gz.
File metadata
- Download URL: openfiles-1.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22d606c72c64dd2f7c8529ae41bee70516dedd368d1b6aaea0673800fada4c42
|
|
| MD5 |
4a5e552fcb3be40b04b5e913157224ac
|
|
| BLAKE2b-256 |
2da085dd2b835b164e694ea0da4d67f52224652eb3bff93feec46767a6f9eeea
|
File details
Details for the file openfiles-1.1.0-py3-none-any.whl.
File metadata
- Download URL: openfiles-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 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 |
430800d588cc460316843e35f370cbc1d48bde2840a5d491e22b09a11f04b5eb
|
|
| MD5 |
4827932689084ab1101ec2be9e3ddc43
|
|
| BLAKE2b-256 |
d40e3fb182251243e2c275e2f0a8313909075518c02c72615cb2c50987f74fd7
|