MyPlex.settings slight clean up and property

This commit is contained in:
blacktwin 2021-05-27 10:06:09 -04:00
parent 277f2ea717
commit 226b9834f7

View file

@ -707,15 +707,15 @@ class MyPlexAccount(PlexObject):
elem = self.query(url)
return self.findItems(elem, cls=AccountOptOut, etag='optOut')
@property
def settings(self):
""" Returns an user account settings :class:`~plexapi.myplex.AccountSettings`
"""
req = requests.get(self.SETTINGS % {'userUUID': self.uuid} ,
req = requests.get(self.SETTINGS % {'userUUID': self.uuid},
headers={'X-Plex-Token': self._token,
'X-Plex-Client-Identifier': X_PLEX_IDENTIFIER})
elem = ElementTree.fromstring(req.text)
for item in elem.iter('setting'):
return AccountSettings(data=item, server=self._server)
return self.findItems(elem, cls=AccountSettings, etag='setting')[0]
def link(self, pin):
""" Link a device to the account using a pin code.