Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Set username, password and server forom env props #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions token_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,18 @@ def print_entry(key, value, tab):
def main():
servers = ["cn", "de", "us", "ru", "tw", "sg", "in", "i2"]
servers_str = ", ".join(servers)
print("Username (email or user ID):")
username = input()
print("Password:")
password = getpass("")
print(f"Server (one of: {servers_str}) Leave empty to check all available:")
server = input()
username = os.getenv('XIAOMI_USERNAME')
if username is None:
print("Username (email or user ID):")
username = input()
password = os.getenv('XIAOMI_PASSWORD')
if password is None:
print("Password:")
password = getpass("")
server = os.getenv('XIAOMI_SERVER')
if server is None:
print(f"Server (one of: {servers_str}) Leave empty to check all available:")
server = input()
while server not in ["", *servers]:
print(f"Invalid server provided. Valid values: {servers_str}")
print("Server:")
Expand Down