Skip to main content

A Python client for BunnyCDN Storage API

Project description

BunnyCDN Storage Python Client

A Python client for interacting with BunnyCDN Storage API. This package provides a simple interface to upload, download, and manage files on BunnyCDN Storage.

Installation

pip install bunnycdn-storage-handler

Configuration

Before using the client, you need to set up your API key, storage zone, and pull zone. You can do this in one of the following ways:

Method 1: Environment Variables

Set the following environment variables in your system:

  • BUNNYCDN_API_KEY: Your BunnyCDN API key.
  • BUNNYCDN_STORAGE_ZONE: Your BunnyCDN storage zone name.
  • BUNNYCDN_PULL_ZONE: Your BunnyCDN pull zone name.

You can set environment variables in your terminal like this:

export BUNNYCDN_API_KEY='your_api_key'
export BUNNYCDN_STORAGE_ZONE='your_storage_zone'
export BUNNYCDN_PULL_ZONE='your_pull_zone'

Method 2: Direct Initialization

Alternatively, you can pass the API key and zone names directly when initializing the BunnyCDNStorage client:

from bunnycdn_storage import BunnyCDNStorage

# Initialize the client with your credentials
storage = BunnyCDNStorage(
    api_key='your_api_key',
    storage_zone='your_storage_zone',
    pull_zone='your_pull_zone'
)

Usage

from bunnycdn_storage import BunnyCDNStorage

# Initialize the client
storage = BunnyCDNStorage()

# Upload a file
cdn_url = storage.upload_file("path/in/storage/", file_content, "filename.txt")

# Download a file
status = storage.download_file("path/to/file.txt", "local/destination/path")

# Check if file exists
exists = storage.object_exists("path/to/file.txt")

# Delete a file
status = storage.delete_object("path/to/file.txt")

Features

  • Upload files to BunnyCDN Storage
  • Download files from BunnyCDN Storage
  • Check if files exist
  • Delete files from storage
  • Automatic CDN URL generation

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

bunnycdn_storage_handler-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

bunnycdn_storage_handler-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file bunnycdn_storage_handler-0.1.1.tar.gz.

File metadata

File hashes

Hashes for bunnycdn_storage_handler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1e9d930bedc0b7cadf2e7b83eda3084524524edcde152fc7095fe03459a814b9
MD5 21dfd20ccaf90c8999758ca281d07c03
BLAKE2b-256 c493739f90b0adde64596a0c7926240622dedd8a4239daf5fcf077647e3f31cd

See more details on using hashes here.

File details

Details for the file bunnycdn_storage_handler-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bunnycdn_storage_handler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39403613c58016b688af7dc083b28937819c22395c5c48663fc8f8bbac0922ea
MD5 87e0a90d29fa794734fbd324712fc377
BLAKE2b-256 ae781d873dcf457dd34ff9a5351c10a2ae4268780272cbbccc4976d751dcc343

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