3 from PLC.Method import Method
4 from PLC.Parameter import Parameter, Mixed
5 from PLC.Auth import PasswordAuth
6 from PLC.Sites import Site, Sites
8 class GetSites(Method):
10 Return an array of structs containing details about all sites. If
11 site_id_list is specified, only the specified sites will be
16 roles = ['admin', 'pi', 'user', 'tech']
20 [Mixed(Site.fields['site_id'],
21 Site.fields['login_base'])]
24 returns = [Site.fields]
30 def __init__(self, *args, **kwds):
31 Method.__init__(self, *args, **kwds)
32 # Update documentation with list of default fields returned
33 self.__doc__ += os.linesep.join(Site.fields.keys())
35 def call(self, auth, site_id_or_login_base_list = None):
37 # Get site information
38 sites = Sites(self.api, site_id_or_login_base_list)
40 # get id of objects affected by this call
41 self.object_ids = sites.keys()
43 # turn each site into a real dict.
44 sites = [dict(site) for site in sites.values()]