Python library for using the juju charm store API.
Python library for using the juju charmstore API.
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.
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.
Make session persistant per CS object
Add the ability to define default includes when getting entity info
make_request: add support for including macaroons header
Do not rely on idm auth anymore. Add support for macaroons instead
Make it possible to disable stats collection Add wallets and budgets Use http bakery. Add charm-actions data to charm_data
Properly quote the user name in the idm query when requesting discharge tokens.
Supports overriding the default URL for backwards compatibility. Accept cs: prefix on entity IDs
Replaces JEM API with JIMM API.
Discharge for user to return an encoded array. Update Makefile to work on clean trusty machine. Trivial rename of development channel.
Unify timeout. Make sure we don’t have unexpected exception. Add discharge token for user endpoint.
Add support case creation.
Add support for terms and plan.
Include owner in api call
Update JEM API calls to version 2.
Add resources in meta search and resource_url method.
Added code for identity manager and juju environment manager APIs
Add LGPL3 license.
Add optional channel arguments.
Make deps less strict to work across trusty -> xenial.
Use Reference from jujubundlelib as a parameter.
Add list endpoint.
Fix for empty macaroon cookie.
Support setting a timeout on charmstore requests.
Add type filter to charmstore search.
Add series filter to charmstore search.
Handle 407 http error from charmstore as EntityNotFound.
Add simple usage example to README.
Minor changes to HACKING.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.