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.0.1.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.0.1.tar.gz.
File metadata
- Download URL: openfiles-1.0.1.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 |
0dbd133cde5b554b86d9b4bdc809a4bf547f50fb236f85d0a1a925726195702d
|
|
| MD5 |
bf8d476e23b1b5daef2e91b8405010e8
|
|
| BLAKE2b-256 |
d6afd641afaef2d01ff9d2f761db046167d64ab045db30a1dd23b424082b5b59
|
File details
Details for the file openfiles-1.0.1-py3-none-any.whl.
File metadata
- Download URL: openfiles-1.0.1-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 |
7d2a0d01e8077dcf37670253208b77216a2041267e3aca19395f2f7c17b2bf87
|
|
| MD5 |
cecb62f5e7e9a73ebd0c2a3cef169000
|
|
| BLAKE2b-256 |
1e0eb8d40c61d3f4539fd1359934c5e513369a1808313a90ebd130afa81c76ce
|