Example #1
0
 def __init__(self, username, secret, endpoint=DEFAULT_ENDPOINT):
     self.username = username
     self.secret = secret
     self.endpoint = endpoint
     data = self.request('Company', 'GetReportSuites')['report_suites']
     suites = [Suite(suite['site_title'], suite['rsid'], self) for suite in data]
     self.suites = utils.AddressableList(suites)
Example #2
0
 def __init__(self,
              username,
              secret,
              endpoint=DEFAULT_ENDPOINT,
              cache=False,
              cache_key=None):
     """Authentication to make requests."""
     self.log = logging.getLogger(__name__)
     self.username = username
     self.secret = secret
     self.endpoint = endpoint
     #Allow someone to set a custom cache key
     self.cache = cache
     if cache_key:
         self.cache_key = cache_key
     else:
         self.cache_key = date.today().isoformat()
     if self.cache:
         data = self.request_cached('Company',
                                    'GetReportSuites')['report_suites']
     else:
         data = self.request('Company', 'GetReportSuites')['report_suites']
     suites = [
         Suite(suite['site_title'], suite['rsid'], self) for suite in data
     ]
     self.suites = utils.AddressableList(suites)
Example #3
0
 def __init__(self, username, secret, endpoint=DEFAULT_ENDPOINT):
     """Authentication to make requests."""
     self.log = logging.getLogger(__name__)
     self.username = username
     self.secret = secret
     self.endpoint = endpoint
     data = self.request('Company', 'GetReportSuites')['report_suites']
     suites = [
         Suite(suite['site_title'], suite['rsid'], self) for suite in data
     ]
     self.suites = utils.AddressableList(suites)
Example #4
0
 def list(cls, name, items, parent, title='title', id='id'):
     values = [cls(item[title], item[id], parent, item) for item in items]
     return utils.AddressableList(values, name)