Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
#3: Specify CS endpoint v4 when calling the blues (fixes #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Young authored and marcoceppi committed Nov 21, 2016
1 parent caea5c8 commit 44143bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions charmstore/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
]

DEFAULT_TIMEOUT = 10
DEFAULT_CS_API_URL = 'https://api.jujucharms.com/v4'


class CharmStore(object):
def __init__(self, api='https://api.jujucharms.com/v4'):
def __init__(self, api=DEFAULT_CS_API_URL):
super(CharmStore, self).__init__()
self.theblues = charmstore.CharmStore(api)
self.theblues = charmstore.CharmStore(url=api)

def requires(self, interfaces=[], limit=None):
return self.interfaces(requires=interfaces)
Expand Down Expand Up @@ -81,7 +82,8 @@ def from_data(cls, data):

return e

def __init__(self, id=None, timeout=DEFAULT_TIMEOUT):
def __init__(self, id=None, api=DEFAULT_CS_API_URL,
timeout=DEFAULT_TIMEOUT):
self.id = None
self.name = None
self.owner = None
Expand All @@ -99,7 +101,7 @@ def __init__(self, id=None, timeout=DEFAULT_TIMEOUT):
self.stats = {}

self.raw = {}
self.theblues = charmstore.CharmStore(timeout=timeout)
self.theblues = charmstore.CharmStore(url=api, timeout=timeout)

if id:
self.load(
Expand Down Expand Up @@ -139,7 +141,8 @@ def load(self, data):


class Charm(Entity):
def __init__(self, id=None, timeout=DEFAULT_TIMEOUT):
def __init__(self, id=None, api=DEFAULT_CS_API_URL,
timeout=DEFAULT_TIMEOUT):
self.summary = None
self.description = None

Expand All @@ -154,7 +157,7 @@ def __init__(self, id=None, timeout=DEFAULT_TIMEOUT):
self.bundles = []
self.terms = []

super(Charm, self).__init__(id, timeout)
super(Charm, self).__init__(id, api=api, timeout=timeout)

def related(self):
data = self.raw.get('charm-related')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='libcharmstore',
version='0.0.4',
version='0.0.5',
packages=['charmstore'],
maintainer='Marco Ceppi',
install_requires=[
Expand Down

0 comments on commit 44143bc

Please sign in to comment.