dd
ddunknown
python
3 years ago
2.4 kB
1
Indexable
Never
def verify(self, email: str, code: str,verifyInfoKey:bool=False,key=None): """ Verify an account. **Parameters** - **email** : Email of the account. - **code** : Verification code. **Returns** - **Success** : 200 (int) - **Fail** : :meth:`Exceptions <amino.lib.util.exceptions>` """ data ={ "validationContext": { "type": 1, "identity": email, "data": {"code": code}}, "deviceID": device.device_id, "timestamp": int(timestamp() * 1000) } if verifyInfoKey is True: data["verifyInfoKey"]=key data=json.dumps(data) response = requests.post(f"{self.api}/g/s/auth/check-security-validation", headers=self.parse_headers(data=data), data=data, proxies=self.proxies, verify=self.certificatePath) if response.status_code != 200: return exceptions.CheckException(json.loads(response.text)) else: return response.status_code def request_verify_code(self, dev: str,email: str, resetPassword: bool = False,verifyInfoKey:bool =False,key=None): """ Request an verification code to the targeted email. **Parameters** - **email** : Email of the account. - **resetPassword** : If the code should be for Password Reset. **Returns** - **Success** : 200 (int) - **Fail** : :meth:`Exceptions <amino.lib.util.exceptions>` """ data = { "identity": email, "type": 1, "deviceID": dev } if verifyInfoKey is True: data["verifyInfoKey"]=key if resetPassword is True: data["level"] = 2 data["purpose"] = "reset-password" data = json.dumps(data) headd=self.parse_headers(deviceId=dev,data=data) headd["NDCAUTH"]=None response = requests.post(f"{self.api}/g/s/auth/request-security-validation", headers=headd, data=data, proxies=self.proxies, verify=self.certificatePath) #print(self.parse_headers(deviceId=dev,data=data)) if response.status_code != 200: return exceptions.CheckException(json.loads(response.text)) else: return response.status_code