Skip to main content

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

MIT 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.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openfiles-1.0.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file openfiles-1.0.2.tar.gz.

File metadata

  • Download URL: openfiles-1.0.2.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

Hashes for openfiles-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9dc5cd45a13789e6db148af8e7eb47196a30461945cf293ccab3dc5a872c4401
MD5 5ae4bfe1cd8ce3d5997b19ebff032bdc
BLAKE2b-256 d2634fdf1187d447a1cdd1017677c5bdb4248dc4828b162b18afd649b8be358f

See more details on using hashes here.

File details

Details for the file openfiles-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: openfiles-1.0.2-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

Hashes for openfiles-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 06899ed8b858b1d0eef7ffecf779878843e048c072e00e540e21368c8b82d3af
MD5 2ba0703f716dc4cbdf5c21aca4ac09c4
BLAKE2b-256 778dc14d4efa866f68b363213fa8ef0dfbc1bda47c54a584850ac316cb272ae9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page