Working but needs tidying
This commit is contained in:
parent
676beab6b3
commit
99fd2e3e8d
Binary file not shown.
@ -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
|
1
src/git/clone/data
Submodule
1
src/git/clone/data
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5b2ea9a418a2cb7e0d6e65fe3ceacfb83ca026e1
|
@ -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)
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user