GithubHelp home page GithubHelp logo

isabella232 / theblues Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juju/theblues

0.0 0.0 0.0 175 KB

Python library for the juju charmstore (v4)

License: GNU Lesser General Public License v3.0

Python 97.16% Makefile 2.84%

theblues's Introduction

theblues

Python library for using the juju charmstore API.

Installation

The easiest way to install theblues is via pip:

$ pip install theblues

Parts of theblues require the use of macaroons (e.g. parsing the return of Charmstore.fetch_macaroon or interacting with IdentityManager.discharge).

To use authenticated aspects of theblues, e.g. JIMM, you'll need to be able to manage macaroons. theblues was developed around libmacaroons. On ubuntu, you can get libmacaroons from a ppa:

$ sudo add-apt-repository ppa:yellow/ppa -y
$ apt-get install libmacaroons0 python-macaroons libsodium13

Without these, theblues cannot make any authenticated requests to the charm store or other services, but is usable to communicate with the charm store for things like looking up charm information.

Usage

Interacting with the charmstore is pretty simple. To look up an entity on the charmstore (e.g. a charm or bundle):

>>> from theblues.charmstore import CharmStore
>>> cs = CharmStore('https://api.jujucharms.com/v4')
>>> entity = cs.entity('wordpress')
>>> entity['Id']
u'cs:trusty/wordpress-2'

Data for an entity is contained in the Meta item of the response, matching the json returned from the charmstores:

>>> entity['Meta']['charm-metadata']['Name']
u'wordpress'

You can also get files for the entity:

>>> cs.files('wordpress')['hooks/install']
u'https://api.jujucharms.com/v4/wordpress/archive/hooks/install
>>> hook = cs.files('wordpress', filename='hooks/install', read_file=True)
>>> print hook
#!/bin/bash

set -xe
...
<snipped for length>
...
juju-log "So, environment is setup. We'll wait for some hooks to fire off before we get all crazy"

To see all methods available, refer to the full docs.

theblues's People

Contributors

anthonydillon avatar chrismacnaughton avatar fabricematrat avatar frankban avatar jcsackett avatar johnsca avatar jrwren avatar jujugui avatar kadams54 avatar marcoceppi avatar

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.