Merge pull request #509 from colouring-london/fix/upload
Update load_csv python script
This commit is contained in:
commit
695bd6c936
@ -60,9 +60,14 @@ def main(base_url, api_key, source_file, json_columns):
|
|||||||
if building_id is None:
|
if building_id is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if 'sust_dec' in line and line['sust_dec'] == '':
|
||||||
|
del line['sust_dec']
|
||||||
|
|
||||||
response_code, response_data = update_building(building_id, line, api_key, base_url)
|
response_code, response_data = update_building(building_id, line, api_key, base_url)
|
||||||
if response_code != 200:
|
if response_code != 200:
|
||||||
print('ERROR', building_id, response_code, response_data)
|
print('ERROR', building_id, response_code, response_data)
|
||||||
|
else:
|
||||||
|
print('DEBUG', building_id, response_code, response_data)
|
||||||
|
|
||||||
|
|
||||||
def update_building(building_id, data, api_key, base_url):
|
def update_building(building_id, data, api_key, base_url):
|
||||||
@ -82,6 +87,7 @@ def find_building(data, base_url):
|
|||||||
if building_id is not None:
|
if building_id is not None:
|
||||||
print("match_by_building_id", building_id)
|
print("match_by_building_id", building_id)
|
||||||
return building_id
|
return building_id
|
||||||
|
|
||||||
if 'toid' in data:
|
if 'toid' in data:
|
||||||
building_id = find_by_reference(base_url, 'toid', data['toid'])
|
building_id = find_by_reference(base_url, 'toid', data['toid'])
|
||||||
if building_id is not None:
|
if building_id is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user