23 lines
628 B
Python
23 lines
628 B
Python
|
import requests
|
||
|
import json
|
||
|
|
||
|
api_url = 'http://192.168.50.10:3456/api/v1/'
|
||
|
|
||
|
def _create_url(path):
|
||
|
return api_url + path
|
||
|
def _post_login_request(username, password, totp_passcode):
|
||
|
login_url = _create_url('login')
|
||
|
payload = {
|
||
|
'long_token': True,
|
||
|
'username': username,
|
||
|
'password': password,
|
||
|
'totp_passcode': totp_passcode
|
||
|
}
|
||
|
return requests.post(login_url, json=payload, timeout=5)
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
username = 'iicd'
|
||
|
password = '9297519Mhz.'
|
||
|
totp_passcode = None
|
||
|
result = _post_login_request(username, password, totp_passcode)
|
||
|
print(result.json())
|