SHARE
TWEET

Untitled

a guest Apr 18th, 2019 165 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # URL + URI
  2. requestUrl = "https://int-ecommerce.nexi.it/" + "ecomm/api/bo/situazioneOrdine";
  3.  
  4. # Parametri per calcolo MAC
  5. apiKey = "<ALIAS>" # Alias fornito da Nexi
  6. chiaveSegreta = "<CHIAVE SEGRETA PER CALCOLO MAC>" # Chiave segreta fornita da Nexi
  7. codTrans = "4bnrgtj34b" # Codice della transazione di cui si cercano i dettagli
  8. timeStamp = (int(time.time())) * 1000
  9.  
  10. # Calcolo MAC
  11. mac_str = 'apiKey=' + apiKey + \
  12.     'codiceTransazione=' + codTrans + \
  13.     "timeStamp=" + str(timeStamp) + \
  14.      chiaveSegreta
  15. mac =  hashlib.sha1(mac_str.encode('utf8')).hexdigest()
  16.  
  17. # Parametri di invio
  18. requestParams = {
  19.     'apiKey': apiKey,
  20.     'codiceTransazione': codTrans,
  21.     'timeStamp': str(timeStamp),
  22.     'mac': mac
  23. }
  24.  
  25. # Chiamata API
  26. response  = requests.post(requestUrl,json=requestParams,headers={'Content-Type':'application/json'})
  27.  
  28. # Parametri di ritorno
  29. response_data = response.json()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top