Adds 2FA code input to tools/plex-gettoken.py (#1319)

* Use getpass for password input

* Add 2FA code input
This commit is contained in:
JonnyWong16 2024-02-04 10:49:55 -08:00 committed by GitHub
parent 4780026a73
commit 768aa58c90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,10 +3,12 @@
"""
Plex-GetToken is a simple method to retrieve a Plex account token.
"""
from getpass import getpass
from plexapi.myplex import MyPlexAccount
username = input("Plex username: ")
password = input("Plex password: ")
password = getpass("Plex password: ")
code = input("Plex 2FA code (leave blank for none): ")
account = MyPlexAccount(username, password)
account = MyPlexAccount(username, password, code=code)
print(account.authenticationToken)