model.py 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import _html
  2. import _bs
  3. import pytz
  4. import datetime
  5. """
  6. Modules _html and _bs4 contain specialized methods.
  7. """
  8. local_timezones = {
  9. "NSW": "Australia/Sydney",
  10. "VIC": "Australia/Melbourne",
  11. "QLD": "Australia/Brisbane",
  12. "WA": "Australia/Perth",
  13. "SA": "Australia/Adelaide",
  14. "TAS": "Australia/Hobart",
  15. "ACT": "Australia/Sydney",
  16. "NT": "Australia/Darwin"}
  17. def scrape_main_page():
  18. this_url = """https://racingaustralia.horse/Home.aspx"""
  19. this_data = _html.get_page(this_url)
  20. venues_all = _bs.get_today_row(this_data)
  21. return venues_all
  22. def get_scratchings(this_venue):
  23. this_data = _html.get_page(this_venue[3])
  24. # print(this_data)
  25. meta_data = _bs.get_meta_data(this_data)
  26. def convert_to_unixtime(dt_object):
  27. utc = pytz.UTC
  28. d = dt_object.astimezone(utc)
  29. epoch = datetime.datetime(1970, 1, 1, 0, 0, 0, tzinfo=pytz.UTC)
  30. ts = int((d - epoch).total_seconds())
  31. return ts