diff --git a/src/20240221_file.docx b/src/20240221_file.docx deleted file mode 100644 index 753fceb..0000000 Binary files a/src/20240221_file.docx and /dev/null differ diff --git a/src/formatter.py b/src/formatter.py index 65db8c1..b784586 100644 --- a/src/formatter.py +++ b/src/formatter.py @@ -6,9 +6,7 @@ def humanYaml(pis_list): manual_review = '' for pis in pis_list: if len(pis['services']) == 1: - print(f"Only one valid service for {pis['pis']}") crs = [] - print(pis) try: for stop in pis['services'][0]['stops']: crs.append(owlboard_connector.convert_tiploc_to_crs(stop)) @@ -17,13 +15,12 @@ def humanYaml(pis_list): except Exception as err: print(err) elif len(pis['services']) > 1: - print(f"More than one possible service for {pis['pis']}") - manual_review += f'## THIS CODE REQUIRES MANUAL VERIFICATION' + manual_review += f'## THIS CODE REQUIRES MANUAL VERIFICATION\n' manual_review += f' - code: "{pis["pis"]}"\n' for service in pis["services"]: crs = [] for stop in service['stops']: crs.append(owlboard_connector.convert_tiploc_to_crs(stop)) - manual_review += f' stops:[{",".join(crs)}]\n' + manual_review += f' stops: [{",".join(crs)}]\n' return additional_pis + manual_review \ No newline at end of file diff --git a/src/git/clone/data b/src/git/clone/data new file mode 160000 index 0000000..5b2ea9a --- /dev/null +++ b/src/git/clone/data @@ -0,0 +1 @@ +Subproject commit 5b2ea9a418a2cb7e0d6e65fe3ceacfb83ca026e1 diff --git a/src/gitea_connector.py b/src/gitea_connector.py index eec2214..f7ee8b2 100644 --- a/src/gitea_connector.py +++ b/src/gitea_connector.py @@ -10,7 +10,7 @@ HEADERS = { 'Content-Type': 'application/json', 'accept': 'application/json', } -BRANCH_NAME = datetime.now().strftime("%Y%m%d-%H%M%S") +BRANCH_NAME = 'auto-' + datetime.now().strftime("%Y%m%d-%H%M%S") ''' @@ -36,4 +36,6 @@ def commit_and_push_changes(text_to_append, commit_message): repo.index.add(["pis/gw.yaml"]) repo.index.commit(commit_message) origin = repo.remote(name='origin') + origin_url_credentials = REPO_URL.replace('https://', f'https://{USER}:{TOKEN}@') + origin.set_url(origin_url_credentials) origin.push(refspec=BRANCH_NAME) diff --git a/src/owlboard_connector.py b/src/owlboard_connector.py index 4e04b50..50e9d8a 100644 --- a/src/owlboard_connector.py +++ b/src/owlboard_connector.py @@ -7,12 +7,12 @@ import requests, os -#OB_PIS_BASE_URL = "https://owlboard.info/api/v2/pis/byCode/" -#OB_TRN_BASE_URL = "https://owlboard.info/api/v2/timetable/train/" -#OB_TIP_BASE_URL = "https://owlboard.info/api/v2/ref/locationCode/tiploc/" -OB_PIS_BASE_URL = "http://localhost:8460/api/v2/pis/byCode/" -OB_TRN_BASE_URL = "http://localhost:8460/api/v2/timetable/train/" -OB_TIP_BASE_URL = "http://localhost:8460/api/v2/ref/locationCode/tiploc/" +OB_PIS_BASE_URL = "https://owlboard.info/api/v2/pis/byCode/" +OB_TRN_BASE_URL = "https://owlboard.info/api/v2/timetable/train/" +OB_TIP_BASE_URL = "https://owlboard.info/api/v2/ref/locationCode/tiploc/" +#OB_PIS_BASE_URL = "http://localhost:8460/api/v2/pis/byCode/" +#OB_TRN_BASE_URL = "http://localhost:8460/api/v2/timetable/train/" +#OB_TIP_BASE_URL = "http://localhost:8460/api/v2/ref/locationCode/tiploc/" OB_TEST_URL = OB_PIS_BASE_URL + "5001" UUID = os.environ.get('DGP_OB_UUID') HEADERS = { @@ -62,6 +62,7 @@ def get_service_detail(trainUid, date): 'vstp': json_res.get('vstp', False) } organised = organise_svc(svc_detail) + print(res.text) print(organised) return organised else: @@ -91,5 +92,4 @@ def convert_tiploc_to_crs(tiploc): json_res = res.json() if json_res: crs = json_res[0]['3ALPHA'] - print(f"TIPLOC: {tiploc}, CRS: {crs}") return crs.lower()