Przeglądaj źródła

Fix issue with parsing date, remove checks

JoostSijm 5 lat temu
rodzic
commit
ac50b4520c
3 zmienionych plików z 2 dodań i 5 usunięć
  1. 0 1
      Pipfile
  2. 2 3
      app/api.py
  3. 0 1
      app/app.py

+ 0 - 1
Pipfile

@@ -13,7 +13,6 @@ python-dotenv = "*"
 psycopg2-binary = "*"
 apscheduler = "*"
 python-telegram-bot = "*"
-python-dateutil = "*"
 
 [requires]
 python_version = "3"

+ 2 - 3
app/api.py

@@ -1,10 +1,10 @@
 """Main application"""
 
 import re
+from datetime import datetime
 
 import requests
 from bs4 import BeautifulSoup
-from dateutil import parser
 
 from app import BASE_URL, HEADERS, LOGGER, RESOURCE_IDS, RESOURCE_NAMES
 
@@ -34,13 +34,12 @@ def parse_deep_explorations(html):
         columns = deep_exploration_tree.find_all('td')
         deep_explorations[deep_exploration_id] = {
             'resource_type': RESOURCE_NAMES[columns[1].text.replace(' resources', '').lower()],
-            'until_date_time': parser.parse(columns[2].string),
+            'until_date_time': datetime.fromtimestamp(int(columns[2]['rat'])),
         }
     return deep_explorations
 
 def deep_explorate(state_id, region_id, resource_type, amount, alt):
     """Main function"""
-    return
     response = requests.get(
         '{}main/content'.format(BASE_URL),
         headers=HEADERS

+ 0 - 1
app/app.py

@@ -66,7 +66,6 @@ def start_deep_exploration(order_id):
             RESOURCE_IDS[order.resource_type],
             order.region_id
         )
-        return
         api.deep_explorate(state.id, order.region_id, order.resource_type, points, False)
     schedule_order(order)