webHook.py 824 B

12345678910111213141516171819202122232425262728293031
  1. import datetime
  2. import logging
  3. import traceback
  4. import requests
  5. from flask import json # To read json data
  6. from flask import request # To receive headers
  7. from flask import Flask # To be able to start the application
  8. from ConfConstant import ConfConstant
  9. from report.AccountReport import AccountReport
  10. app = Flask(__name__)
  11. @app.route('/')
  12. def api_root():
  13. return 'Welcome guys'
  14. @app.route('/webhook/account_report', methods=['POST'])
  15. def api_webhook_messages():
  16. my_info = json.loads(request.param)
  17. account_id = my_info["account_id"]
  18. start_date = my_info["start_time"]
  19. end_date = my_info["end_time"]
  20. date_type = my_info["date_type"]
  21. AccountReport().handler(date_type, account_id, start_date, end_date)
  22. if __name__ == '__main__':
  23. app.run(port=8765, host=ConfConstant.URL, debug=True)