Skip to main content

Python library for using the juju charm store API.

Project description

Python library for using the juju charmstore API.

Installation

The easiest way to install theblues is via pip:

$ pip install theblues

Note that theblues requires python-macaroons (which has its own dependencies), which must be installed from a ppa:

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

Without these, theblues cannot communicate with the charmstore.

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.

History

0.1.0 (2015-12-04)

  • Fix for empty macaroon cookie.

0.1.1 (2016-01-25)

  • Use Reference from jujubundlelib as a parameter.

  • Add list endpoint.

0.0.5 (2015-11-20)

  • Expose common-info.

  • Fix import.

0.0.4 (2015-06-10)

  • Support setting a timeout on charmstore requests.

0.0.3 (2015-05-04)

  • Add type filter to charmstore search.

0.0.2 (2015-04-08)

  • Add series filter to charmstore search.

  • Handle 407 http error from charmstore as EntityNotFound.

  • Add simple usage example to README.

  • Minor changes to HACKING.

  • Minor fixes.

0.0.1 (2015-03-19)

  • Initial release.

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

theblues-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

File details

Details for the file theblues-0.1.1.tar.gz.

File metadata

  • Download URL: theblues-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for theblues-0.1.1.tar.gz
Algorithm Hash digest
SHA256 176f0eb5bb628f1794ce1cb22b00402fd8077e1b6ddeeec9be600fc3e205a5d7
MD5 59a3d709d042f30cdf3499befd689474
BLAKE2b-256 2c23c406139aec2f84b8e518ad6ec472ba2198400de81a1e3e0125c62a392875

See more details on using hashes here.

Supported by

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