-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetBlurAuthKey.py
38 lines (30 loc) · 1.04 KB
/
GetBlurAuthKey.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import requests
import SignMessage
import Constants
burnerwallet = SignMessage.createburnerwallet()
def getAuthChallenge():
url = "https://blur.p.rapidapi.com/auth/challenge"
payload = { "walletAddress": SignMessage.getaddr(burnerwallet) }
headers = {
"content-type": "application/json",
"X-RapidAPI-Key": Constants.X_RapidAPI_Key,
"X-RapidAPI-Host": "blur.p.rapidapi.com"
}
response = requests.post(url, json=payload, headers=headers)
return response.json()
def GetAccessToken(response):
url = "https://blur.p.rapidapi.com/auth/login"
payload = {
"message": response['message'],
"walletAddress": response['walletAddress'],
"expiresOn": response['expiresOn'],
"hmac": response['hmac'],
"signature": SignMessage.signmess(response['message'], SignMessage.getpk(burnerwallet)).signature.hex()
}
headers = {
"content-type": "application/json",
"X-RapidAPI-Key": Constants.X_RapidAPI_Key,
"X-RapidAPI-Host": "blur.p.rapidapi.com"
}
access_token = requests.post(url, json=payload, headers=headers)
return access_token.json()