Add logging and switch to curl

I am getting many truncated JSON file that then do not parse. More from
wget to curl to see if this helps.
This commit is contained in:
Guy Taylor
2019-04-04 17:34:24 +01:00
committed by Sebastian Thiel
parent 57a7ee37e5
commit 93dba234dd

View File

@@ -23,6 +23,8 @@
discovery_url = 'https://www.googleapis.com/discovery/v1/'
apis = json.loads(urllib2.urlopen(discovery_url + "apis").read())
print('Loaded {} apis from Google'.format(len(apis['items'])))
for manualy_api in api.get('manually_added', list()):
apis['items'].append({
'name': manualy_api['name'],
@@ -30,6 +32,8 @@
'discoveryRestUrl': manualy_api['discovery_rest_url']
})
print('Total {} apis'.format(len(apis['items'])))
json_api_targets = []
suffix = make.target_suffix
@@ -79,9 +83,10 @@
i.get('output_dir', '') + '/' + i.source.strip('../')) for i in make.templates]
api_json = util.api_json_path(directories.api_base, an, version)
api_meta_dir = os.path.dirname(api_json)
print('Loading JSON: {}'.format(api_json))
with open(api_json, 'r') as fh:
api_crate_publish_file = api_meta_dir + '/crates/' + util.crate_version(cargo.build_version +
make.aggregated_target_suffix, json.load(fh).get('revision', '00000000'))
crate_version = util.crate_version(cargo.build_version + make.aggregated_target_suffix, json.load(fh).get('revision', '00000000'))
api_crate_publish_file = api_meta_dir + '/crates/' + crate_version
api_json_overrides = api_meta_dir + '/' + an + '-api_overrides.yaml'
type_specific_cfg = gen_type_cfg_path(make.id)
api_json_inputs = api_json + ' $(API_SHARED_INFO) ' + type_specific_cfg
@@ -191,7 +196,7 @@ help${agsuffix}:
%>\
${fake_target}:
@mkdir -p ${target_dir}
@-wget -nv '${url}' -O ${target} || rm -f ${target}
@-curl --silent --show-error --fail --retry 3 -o '${target}' '${url}'
% endfor
update-json: ${' '.join(json_api_targets)}