fs-box-sync
Python SDK for Box API with seamless Box Drive integration.
Installation
pip install fs-box-sync
Or with uv:
uv add fs-box-sync
Quick Start
import asyncio
from fs_box_sync import box, BoxConfig
# Configure with your credentials
box.configure(BoxConfig(
client_id='your-client-id',
client_secret='your-client-secret',
))
async def main():
# List files in root folder
files = await box.list_folder_items('0')
for f in files:
print(f"{f.type}: {f.name} ({f.id})")
# Upload a file
file_id = await box.upload_file('folder-id', './local-file.pdf')
# Download a file
await box.download_file('file-id', './downloaded-file.pdf')
# Read file content
content = await box.get_file_content('file-id')
asyncio.run(main())
Architecture
The SDK provides a 3-layer architecture:
BoxFS (High-level filesystem API)
↓
BoxDrive (Sync bridge for local filesystem)
↓
BoxAPI (Pure REST API wrapper)
- BoxAPI: Pure REST API wrapper with token management, retry logic, and chunked uploads
- BoxDrive: Sync bridge for Box Drive local filesystem integration
- BoxFS: High-level filesystem-like API combining both layers
Authentication
Tier 1: Developer Token (Quick Testing)
box.configure(BoxConfig(
access_token='your-developer-token', # Expires in ~1 hour
))
Tier 2: OAuth with Refresh Token (Production)
box.configure(BoxConfig(
client_id='your-client-id',
client_secret='your-client-secret',
refresh_token='your-refresh-token', # Auto-renewing
))
Tier 3: Custom Token Provider (Enterprise)
async def get_token(callback_url: str) -> str:
# Your OAuth automation logic here
return authorization_code
box.configure(BoxConfig(
client_id='your-client-id',
client_secret='your-client-secret',
token_provider=get_token,
))
Box Drive Integration
If Box Drive is installed, you can access files locally:
# Get local path for a Box file
local_path = await box.get_local_path('file-id', 'file')
# Wait for sync and get local path
local_path = await box.get_local_path_synced('file-id', 'file')
# Check if Box Drive is available
if box.is_box_drive_available():
# Open file locally
await box.open_locally('file-id', 'file')
API Reference
File Operations
upload_file(folder_id, file_path)- Upload a filedownload_file(file_id, dest_path)- Download a fileget_file_content(file_id)- Get file content as stringget_file_info(file_id)- Get file metadatadelete_file(file_id)- Delete a filemove_file(file_id, to_folder_id)- Move a file
Folder Operations
list_folder_items(folder_id)- List folder contentsget_folder_info(folder_id)- Get folder metadatacreate_folder_if_not_exists(parent_id, name)- Create foldersearch(folder_id, query)- Search for files/folders
Webhooks
get_all_webhooks()- List all webhookscreate_webhook(folder_id, address)- Create a webhookdelete_webhook(webhook_id)- Delete a webhookdelete_all_webhooks()- Delete all webhooks
License
MIT
Metadata
Release files for fs-box-sync 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fs_box_sync-0.1.0.tar.gz | 46.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fs_box_sync-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.5 kB
Release files / fs_box_sync-0.1.0.tar.gz
| Download URL | fs_box_sync-0.1.0.tar.gz |
|---|---|
| Size | 46.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40d0cdde24270b33b40cb44958b7f1e7dae6fb28733dfbd07cddf6108ae054fc
|
|
BLAKE2b-256 checksum How to use checksums |
91c788608cf6ecc730a0dfa11c7af6398b5d33da13934e53cc981583883c62fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 25, 2026.
Transparency logRelease files / fs_box_sync-0.1.0-py3-none-any.whl
| Download URL | fs_box_sync-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01dc7861b7e7c8217ea2bf8471be0c526ee4bea9a9532ade33040c4aa7491b9c
|
|
BLAKE2b-256 checksum How to use checksums |
bea6fd807101010770a36f223aa3f15bd08f89220a2aad11afe0f54ffeee0ce6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 25, 2026.
Transparency log