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
14 If return_fields is specified, only the specified fields will be
15 returned, if set. Otherwise, the default set of fields returned is:
19 roles = ['admin', 'pi', 'user', 'tech']
23 [Mixed(Site.fields['site_id'],
24 Site.fields['login_base'])]
27 returns = [Site.fields]
32 def __init__(self, *args, **kwds):
33 Method.__init__(self, *args, **kwds)
34 # Update documentation with list of default fields returned
35 self.__doc__ += os.linesep.join(Site.fields.keys())
37 def call(self, auth, site_id_or_login_base_list = None):
39 # Get site information
40 sites = Sites(self.api, site_id_or_login_base_list)
42 # turn each site into a real dict.
43 sites = [dict(site) for site in sites.values()]