Git Product home page Git Product logo

moln's Introduction

moln {/mo:ln/}

Stupid simple access to Microsoft Azure services using Python. Built for the rest of us.

To install:

pip install moln

Azure Storage Blobs

pathlib-like API to access blobs in Azure Storage.

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)

moln's People

Contributors

johanste avatar

Watchers

 avatar  avatar

Forkers

annatisch

moln's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.