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.1.0.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.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

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

Hashes for openfiles-1.1.0.tar.gz
Algorithm Hash digest
SHA256 22d606c72c64dd2f7c8529ae41bee70516dedd368d1b6aaea0673800fada4c42
MD5 4a5e552fcb3be40b04b5e913157224ac
BLAKE2b-256 2da085dd2b835b164e694ea0da4d67f52224652eb3bff93feec46767a6f9eeea

See more details on using hashes here.

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

Hashes for openfiles-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 430800d588cc460316843e35f370cbc1d48bde2840a5d491e22b09a11f04b5eb
MD5 4827932689084ab1101ec2be9e3ddc43
BLAKE2b-256 d40e3fb182251243e2c275e2f0a8313909075518c02c72615cb2c50987f74fd7

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