Advertisement
Dimka_lang2

Untitled

Apr 10th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. from SimpleQIWI import *
  2. import json
  3. import time
  4.  
  5. N53 = 'NUMBER'
  6. api53 = 'API'  # https://qiwi.com/api
  7. api53 = QApi(token=api53, phone=N53)
  8. testing2 = json.dumps(api53.payments, indent=4)
  9. testing1 = json.loads(testing2)
  10. txnId_forBOT = testing1['data'][0]['txnId']
  11. trmTxnId_forBOT = testing1['data'][0]['trmTxnId']
  12. status_forBOT = testing1['data'][0]['status']
  13. print(testing1['data'][0]['sum']['amount'])
  14.  
  15.  
  16. def checking_forWHILE():
  17.     global api53
  18.     testing2 = json.dumps(api53.payments, indent=4)
  19.     testing1 = json.loads(testing2)
  20.     txnId_forBOT2 = testing1['data'][0]['txnId']
  21.     trmTxnId_forBOT2 = testing1['data'][0]['trmTxnId']
  22.     status_forBOT2 = testing1['data'][0]['status']
  23.     return txnId_forBOT2, trmTxnId_forBOT2, status_forBOT2
  24.  
  25.  
  26. def checking_newPAY():
  27.     while True:
  28.         global txnId_forBOT
  29.         global trmTxnId_forBOT
  30.         global status_forBOT
  31.         data = checking_forWHILE()
  32.         txnId_forIN = data[0]
  33.         trmTxnId_forIN = data[1]
  34.         status_forIN = data[2]
  35.         if txnId_forBOT != txnId_forIN or trmTxnId_forBOT != trmTxnId_forIN and status_forIN == 'Success':
  36.             print('НОВЫЙ ПЕРЕВОД!')
  37.             txnId_forBOT =  txnId_forIN
  38.             trmTxnId_forBOT =  trmTxnId_forIN
  39.             status_forBOT = status_forIN
  40.         else:
  41.             time.sleep(10)
  42.             pass
  43.  
  44.  
  45. checking_newPAY()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement