Command line tool to get plex tokens

This commit is contained in:
Michael Shepanski 2017-02-25 00:12:24 -05:00
parent 5a9e0afbe2
commit 56e8c565c5

20
tools/listtokens.py Executable file
View 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)