Stupid, simple Azure client library built for the rest of us
Project description
moln {/mo:ln/}
Stupid simple access to Microsoft Azure services using Python. Built for the rest of us.
This is very much a work in progress. Feedback is welcome.
To install:
pip install moln
import pathlib
import moln.storage
# Authentication is done using the azure-identity package.
# By default, it will use the azure.identity.DefaultAzureCredential
account = moln.storage.attach(account_url='https://molntest.blob.core.windows.net')
# Creating containers - just like you create directories!
container = account / 'jabbadabbadoo'
container.mkdir(exists_ok=True)
local_file = pathlib.Path('./stuff.json')
remote_file = container / 'stuff.json'
# Upload blobs like you would upload files - with the option to
# specify metadata like Content-Type headers for the uploaded blob.
if not remote_file.exists():
with local_file.open(mode='rb') as lf:
with remote_file.open(mode='wb', content_settings=azure.storage.blob.ContentSettings(content_type='application/json')) as rb:
rb.write(lf.read())
# Work with the blob as if you opened a local file
with remote_file.open(mode='r') as rb:
import json
data = json.load(rb)
print(data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
moln-0.0.1a1.tar.gz
(3.8 kB
view hashes)
Built Distribution
moln-0.0.1a1-py3-none-any.whl
(3.8 kB
view hashes)