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.

Source Distribution

pyblazeb2-0.0.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

pyblazeb2-0.0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file pyblazeb2-0.0.2.tar.gz.

File metadata

  • Download URL: pyblazeb2-0.0.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0

File hashes

Hashes for pyblazeb2-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5a1def074ab81d6b62aa63ecc33606b8e831e44995a56b9df6d87563119e79b6
MD5 d1352a827dd9571cdc344401a295697d
BLAKE2b-256 4560127bb596ca10d10ed551b7c40dd387e618c0570cc1bb0e2168f768d07d95

See more details on using hashes here.

File details

Details for the file pyblazeb2-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyblazeb2-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0

File hashes

Hashes for pyblazeb2-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b459841c94a5ed50b2a93c617ae54191b39e3c413ff855482ff58866b8126bc9
MD5 cae65578dfc531ca22acb39e73433eb8
BLAKE2b-256 b28b57fc9972daf58cb4bdad64b13ecdefb3043e4058e869effef9bd7fe99415

See more details on using hashes here.

Supported by

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