AirasiaExchangeRateTest.py 904 B

12345678910111213141516171819202122232425262728293031323334
  1. import json;
  2. import time;
  3. html = open("D:/test/airasia/airasiaRate").read()
  4. htmlJson = json.loads(html);
  5. ExternalRateLists = htmlJson["ExternalRateList"];
  6. ExchangeRateEntitys = [];
  7. for ExternalRateList in ExternalRateLists:
  8. baseCurrency = ExternalRateList["quotedCurrency"];
  9. transactionCurrency = ExternalRateList["collectedCurrency"];
  10. curDate = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()));
  11. exchangeRate = ExternalRateList["exchangeRate"];
  12. updateDate = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()));
  13. source =1;
  14. ExchangeRateEntity = {
  15. "baseCurrency":baseCurrency,
  16. "curDate":curDate,
  17. "transactionCurrency":transactionCurrency,
  18. "exchangeRate":exchangeRate,
  19. "updateDate":updateDate,
  20. "source":source
  21. }
  22. ExchangeRateEntitys.append(ExchangeRateEntity);
  23. print(ExchangeRateEntitys)