Update URL structure to communicate with NACEX API. The pasword must be

encrypted with MD5.
This commit is contained in:
Bernat Brunet 2022-08-22 09:28:51 +02:00
parent 4c99bbd2fb
commit 9fae4e3ecf
1 changed files with 6 additions and 1 deletions

View File

@ -1,13 +1,18 @@
#This file is part of nacex. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import requests
import hashlib
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' % (
api.url,
method, api.username,
api.password,
hashlib.md5(password).hexdigest(),
nacex_data(data))
return requests.get(url)