>>> p100.login()
Traceback (most recent call last):
File "/home/zextor/.local/lib/python3.10/site-packages/PyP100/PyP100.py", line 168, in login
self.token = ast.literal_eval(decryptedResponse)["result"]["token"]
KeyError: 'result'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zextor/.local/lib/python3.10/site-packages/PyP100/PyP100.py", line 172, in login
raise Exception(f"Error Code: {errorCode}, {errorMessage}")
Exception: Error Code: -1501, Invalid Request or Credentials
스마트 플러그인 로그인을 할 때 오류나는 부분을 해결하기 위해서는 아래와 같이 수정이 필요하다.
def login(self):
URL = f"http://{self.ipAddress}/app"
Payload = {
"method":"login_device",
"params":{
"password": self.encodedPassword,
"username": self.encodedEmail
},
"requestTimeMils": int(round(time.time()*1000)), #0,
}
headers = {
"Cookie": self.cookie
}
EncryptedPayload = self.tpLinkCipher.encrypt(json.dumps(Payload))
SecurePassthroughPayload = {
"method":"securePassthrough",
"params":{
"request": EncryptedPayload
}
}
9번째 줄, 처음은 0 이었는데 임의의 시간값을 넣어주면 오류가 해결된다.
참고한 페이지는 https://github.com/fishbigger/TapoP100/issues/101 이다.
최근 댓글