updated for AMP
This commit is contained in:
parent
2dab966846
commit
ea85033b00
@ -89,5 +89,21 @@ Swap - After finalize Node2
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##### 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