mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 05:30:20 +00:00
Command line tool to get plex tokens
This commit is contained in:
parent
5a9e0afbe2
commit
56e8c565c5
1 changed files with 20 additions and 0 deletions
20
tools/listtokens.py
Executable file
20
tools/listtokens.py
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from getpass import getpass
|
||||
from plexapi.exceptions import BadRequest
|
||||
from plexapi.myplex import MyPlexAccount
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
username = input('What is your plex.tv username: ')
|
||||
password = getpass('What is your plex.tv password: ')
|
||||
print(); count = 0
|
||||
try:
|
||||
for resource in MyPlexAccount(username, password).resources():
|
||||
if resource.accessToken:
|
||||
print('%s %s' % (resource.accessToken, resource.name))
|
||||
count += 1
|
||||
if not count:
|
||||
print('Did not found any resources on your account.')
|
||||
except BadRequest as err:
|
||||
print('Unable to login to plex.tv: %s' % err)
|
Loading…
Reference in a new issue