Merge pull request #509 from colouring-london/fix/upload

Update load_csv python script
This commit is contained in:
Tom Russell 2020-04-09 10:19:32 +01:00 committed by GitHub
commit 695bd6c936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,9 +60,14 @@ def main(base_url, api_key, source_file, json_columns):
if building_id is None:
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)
if response_code != 200:
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):
@ -82,6 +87,7 @@ def find_building(data, base_url):
if building_id is not None:
print("match_by_building_id", building_id)
return building_id
if 'toid' in data:
building_id = find_by_reference(base_url, 'toid', data['toid'])
if building_id is not None: