Update URL structure to communicate with NACEX API. The pasword must be
encrypted with MD5.
This commit is contained in:
parent
4c99bbd2fb
commit
9fae4e3ecf
7
utils.py
7
utils.py
|
@ -1,13 +1,18 @@
|
||||||
#This file is part of nacex. The COPYRIGHT file at the top level of
|
#This file is part of nacex. The COPYRIGHT file at the top level of
|
||||||
#this repository contains the full copyright notices and license terms.
|
#this repository contains the full copyright notices and license terms.
|
||||||
import requests
|
import requests
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
|
||||||
def nacex_call(api, method, data):
|
def nacex_call(api, method, data):
|
||||||
|
|
||||||
|
password = api.password
|
||||||
|
if isinstance(password, str):
|
||||||
|
password = password.encode('utf-8')
|
||||||
url = '%s?method=%s&user=%s&pass=%s&data=%s' % (
|
url = '%s?method=%s&user=%s&pass=%s&data=%s' % (
|
||||||
api.url,
|
api.url,
|
||||||
method, api.username,
|
method, api.username,
|
||||||
api.password,
|
hashlib.md5(password).hexdigest(),
|
||||||
nacex_data(data))
|
nacex_data(data))
|
||||||
return requests.get(url)
|
return requests.get(url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue