updated for AMP
This commit is contained in:
parent
2dab966846
commit
ea85033b00
@ -88,6 +88,22 @@ Swap - After finalize Node2
|
|||||||
"3e62af3c80c56ab6fec3d1e5646637152afebaf2a86ace075bbb7a88702e1fe5": 9.00000000
|
"3e62af3c80c56ab6fec3d1e5646637152afebaf2a86ace075bbb7a88702e1fe5": 9.00000000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### PYTHON AMP
|
||||||
|
|
||||||
|
API_URL = 'https://amp.blockstream.com/api'
|
||||||
|
def get_auth_token_header(username, password):
|
||||||
|
# api/user/obtain_token
|
||||||
|
|
||||||
|
url = f'{API_URL}/user/obtain_token'
|
||||||
|
headers = {'content-type': 'application/json'}
|
||||||
|
payload = {'username': username, 'password': password}
|
||||||
|
response = requests.post(url, data=json.dumps(payload), headers=headers)
|
||||||
|
assert response.status_code == 200
|
||||||
|
json_data = json.loads(response.text)
|
||||||
|
token = json_data['token']
|
||||||
|
return {'content-type': 'application/json', 'Authorization': f'token {token}'}
|
||||||
|
|
||||||
|
header = get_auth_token_header('your_amp_username', 'your_amp_password')
|
||||||
|
print(header)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user