mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 05:30:20 +00:00
Add minimal api to list system accounts
This commit is contained in:
parent
dd8648b9de
commit
6ade28868c
1 changed files with 18 additions and 0 deletions
|
@ -182,6 +182,13 @@ class PlexServer(PlexObject):
|
|||
""" Returns the :class:`~plexapi.server.Account` object this server belongs to. """
|
||||
data = self.query(Account.key)
|
||||
return Account(self, data)
|
||||
|
||||
def systemAccounts(self):
|
||||
""" Returns the :class:`~plexapi.server.SystemAccounts` objects this server contains. """
|
||||
accounts = []
|
||||
for elem in self.query('/accounts'):
|
||||
accounts.append(SystemAccount(self, data=elem))
|
||||
return accounts
|
||||
|
||||
def myPlexAccount(self):
|
||||
""" Returns a :class:`~plexapi.myplex.MyPlexAccount` object using the same
|
||||
|
@ -507,3 +514,14 @@ class Account(PlexObject):
|
|||
self.subscriptionFeatures = utils.toList(data.attrib.get('subscriptionFeatures'))
|
||||
self.subscriptionActive = cast(bool, data.attrib.get('subscriptionActive'))
|
||||
self.subscriptionState = data.attrib.get('subscriptionState')
|
||||
|
||||
|
||||
class SystemAccount(PlexObject):
|
||||
""" Minimal api to list system accounts. """
|
||||
key = '/accounts'
|
||||
|
||||
def _loadData(self, data):
|
||||
self._data = data
|
||||
self.accountId = cast(int, data.attrib.get('id'))
|
||||
self.accountKey = data.attrib.get('key')
|
||||
self.name = data.attrib.get('name')
|
||||
|
|
Loading…
Reference in a new issue