Skip to main content

A compact library for interacting with Backblaze b2 buckets

Project description

Pyblazeb2


Pyblazeb2 is a Python 3 module for accessing the Backblaze B2 API


To install run: 
 pip install pyblazeb2

Examples


from pyblazeb2 import BackBlazeB2
b2 = BackBlazeB2(account_id, app_key)

# Upload an entire directory concurrently
b2.recursive_upload('/path/to/foobar', bucket_name='my-bucket', multithread=True)

# Upload a single file without a password
b2.upload_file('/path/to/file.txt', bucket_name='baz')

# Upload a single file, then download
b2.upload_file('/path/to/secrets.txt', bucket_name='baz')
response = b2.download_file_by_name('/path/to/myfile.txt', 'savedfile.txt')

# List all of your buckets
buckets = b2.list_buckets()

# Create a bucket
response = b2.create_bucket('new-bucket', bucket_type='allPrivate')

# Download a file by name
response = b2.download_file_by_name('/path/to/myfile.txt', 'savedfile.txt')

# Authorize download for a private file
bucket_id = "" # Id of bucket which you want authorize download file
bucket_name = "" # Verbose name of bucket
file_name_prefix = ""
url_authorized_download = b2.get_download_authorization(
    bucket_id=bucket_id, bucket_name=bucket_name,
    file_name_prefix=file_name_prefix)
# The response some looks like this:
# https://f345.backblazeb2.com/file/photos/cute/kitten.jpg?Authorization=3_20160803004041_53982a92f631a8c7303e3266_d940c7f5ee17cd1de3758aaacf1024188bc0cd0b_000_20160804004041_0006_dnld

# Download with authorized url
b2.download_file_with_authorized_url(url_authorized_download, 'file_name.log')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pyblazeb2-0.0.23-py3-none-any.whl (6.2 kB) Copy SHA256 hash SHA256 Wheel py3
pyblazeb2-0.0.23.tar.gz (5.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page