Skip to content

Commit 4c04b76

Browse files
committed
Update server.py
add a way to get a transit token. Dunno about the name.
1 parent 2b45284 commit 4c04b76

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

plexapi/server.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ def account(self):
182182
""" Returns the :class:`~plexapi.server.Account` object this server belongs to. """
183183
data = self.query(Account.key)
184184
return Account(self, data)
185-
185+
186+
def createToken(self, type='delegation', scope='all'):
187+
"""Create a temp access token for the server."""
188+
q = self.query('/security/token?type=%s&scope=%s' % (type, scope))
189+
return q.attrib.get('token')
190+
186191
def systemAccounts(self):
187192
""" Returns the :class:`~plexapi.server.SystemAccounts` objects this server contains. """
188193
accounts = []
@@ -325,7 +330,7 @@ def history(self, maxresults=9999999, mindate=None):
325330
326331
Parameters:
327332
maxresults (int): Only return the specified number of results (optional).
328-
mindate (datetime): Min datetime to return results from. This really helps speed
333+
mindate (datetime): Min datetime to return results from. This really helps speed
329334
up the result listing. For example: datetime.now() - timedelta(days=7)
330335
"""
331336
results, subresults = [], '_init'

0 commit comments

Comments
 (0)