|
9 | 9 | from packaging.version import Version |
10 | 10 | import pandas as pd |
11 | 11 | from pathlib import Path |
12 | | -from datetime import datetime |
| 12 | + |
| 13 | +# from datetime import datetime |
13 | 14 | from distutils.dir_util import copy_tree |
14 | 15 | import geojson |
15 | 16 | from requests import HTTPError |
@@ -859,19 +860,19 @@ def validate_and_add_data_input( |
859 | 860 | plugin=endpoint["plugin"], |
860 | 861 | refill_todays_logs=True, |
861 | 862 | ) |
862 | | - ''' |
863 | | - try: |
864 | | - # log is already returned from fetch, but read from file if needed for verification |
865 | | - log_path = collector.log_path(datetime.utcnow(), endpoint["endpoint"]) |
866 | | - if os.path.isfile(log_path): |
867 | | - with open(log_path, "r") as f: |
868 | | - log = json.load(f) |
869 | | - except Exception as e: |
870 | | - print( |
871 | | - f"Error: The log file for {endpoint} could not be read from path {log_path}.\n{e}" |
872 | | - ) |
873 | | - break |
874 | | - ''' |
| 863 | + |
| 864 | + # try: |
| 865 | + # # log is already returned from fetch, but read from file if needed for verification |
| 866 | + # log_path = collector.log_path(datetime.utcnow(), endpoint["endpoint"]) |
| 867 | + # if os.path.isfile(log_path): |
| 868 | + # with open(log_path, "r") as f: |
| 869 | + # log = json.load(f) |
| 870 | + # except Exception as e: |
| 871 | + # print( |
| 872 | + # f"Error: The log file for {endpoint} could not be read from path {log_path}.\n{e}" |
| 873 | + # ) |
| 874 | + # break |
| 875 | + |
875 | 876 | log_status = log.get("status", None) |
876 | 877 | exception = log.get("exception", None) |
877 | 878 | if fetch_status not in [FetchStatus.OK, FetchStatus.ALREADY_FETCHED]: |
@@ -907,6 +908,9 @@ def validate_and_add_data_input( |
907 | 908 | "organisation": row["organisation"], |
908 | 909 | "entry-date": row["entry-date"], |
909 | 910 | } |
| 911 | + # elif: |
| 912 | + # raise Error( |
| 913 | + # f"No resource avaible: {log_status if log_status else exception}" |
910 | 914 | ) |
911 | 915 |
|
912 | 916 | return collection, endpoint_resource_info |
|
0 commit comments