mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-12 23:17:07 +00:00
26447d1931
* Add exception for two-factor required * Update tools/plex-gettoken.py with 2FA exception
19 lines
526 B
Python
Executable file
19 lines
526 B
Python
Executable file
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Plex-GetToken is a simple method to retrieve a Plex account token.
|
|
"""
|
|
from getpass import getpass
|
|
from plexapi.exceptions import TwoFactorRequired
|
|
from plexapi.myplex import MyPlexAccount
|
|
|
|
username = input("Plex username: ")
|
|
password = getpass("Plex password: ")
|
|
|
|
try:
|
|
account = MyPlexAccount(username, password)
|
|
except TwoFactorRequired:
|
|
code = input("Plex 2FA code: ")
|
|
account = MyPlexAccount(username, password, code=code)
|
|
|
|
print(account.authenticationToken)
|