Skip to content
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
6 changes: 3 additions & 3 deletions tapo-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def login(username, password):
"""Authenticates a user towards the TP-Link Tapo Cloud."""
terminal_uuid = str(uuid.uuid1()).replace('-','').upper()

url = 'https://n-wap-gw.tplinkcloud.com/api/v2/account/login'
url = 'https://n-euw1-wap-gw.tplinkcloud.com/api/v2/account/login'
content = {"appType":"TP-Link_Tapo_Android","appVersion":"2.12.705","cloudPassword":password,"cloudUserName":username,"platform":"Android 12","refreshTokenNeeded":False,"terminalMeta":"1","terminalName":"Tapo CLI","terminalUUID":terminal_uuid}
content = json.dumps(content)
res = post(url, content, headers_post(content, '/api/v2/account/login'))
Expand All @@ -152,7 +152,7 @@ def login(username, password):
# Login but with extra steps
if 'MFAProcessId' in config:
mfa_process_id = res['result']['MFAProcessId']
url = 'https://n-wap-gw.tplinkcloud.com/api/v2/account/getPushVC4TerminalMFA'
url = 'https://n-euw1-wap-gw.tplinkcloud.com/api/v2/account/getPushVC4TerminalMFA'
content = {"appType":"TP-Link_Tapo_Android","cloudPassword":password,"cloudUserName":username,"terminalUUID":terminal_uuid}
content = json.dumps(content)
res = post(url, content, headers_post(content, '/api/v2/account/getPushVC4TerminalMFA'))
Expand All @@ -162,7 +162,7 @@ def login(username, password):
print('Check your Tapo App for the MFA code!')
mfa_code = str(input('MFA Code (no spaces or dashes): '))

url = 'https://n-wap-gw.tplinkcloud.com/api/v2/account/checkMFACodeAndLogin'
url = 'https://n-euw1-wap-gw.tplinkcloud.com/api/v2/account/checkMFACodeAndLogin'
content = {"appType":"TP-Link_Tapo_Android","cloudUserName":username,"code":mfa_code,"MFAProcessId":mfa_process_id,"MFAType":1,"terminalBindEnabled":True}
content = json.dumps(content)
res = post(url, content, headers_post(content, '/api/v2/account/checkMFACodeAndLogin'))
Expand Down