diff --git a/.vscode/settings.json b/.vscode/settings.json index f8be830..3eb0f58 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "peacock.color": "#81ec64", "workbench.colorCustomizations": { "activityBar.background": "#a6f291", + "activityBar.activeBackground": "#a6f291", "activityBar.activeBorder": "#708cee", "activityBar.foreground": "#15202b", "activityBar.inactiveForeground": "#15202b99", diff --git a/bel/edge/pipeline.py b/bel/edge/pipeline.py index 4a18e7c..126b9f1 100755 --- a/bel/edge/pipeline.py +++ b/bel/edge/pipeline.py @@ -71,7 +71,7 @@ def process_nanopub( if token: headers = {"Authorization": f"Bearer {token}"} - r = http_client.get(nanopub_url, headers=headers, verify=False) + r = http_client.get(nanopub_url, headers=headers) nanopub = r.json() @@ -253,7 +253,7 @@ def edge_iterator(edges=[], edges_fn=None): "annotations", "edge_types", ] - for key in relation_hash: + for key in list(relation_hash.keys()): if key not in keep: relation_hash.pop(key, None) diff --git a/bel/utils.py b/bel/utils.py index 1e212a9..7e64671 100644 --- a/bel/utils.py +++ b/bel/utils.py @@ -40,14 +40,15 @@ def timespan(start_time): def download_file(url): """Download file""" - response = http_client.get(url, stream=True) - fp = tempfile.NamedTemporaryFile() - for chunk in response.iter_content(chunk_size=1024): - if chunk: # filter out keep-alive new chunks - fp.write(chunk) - - # log.info(f'Download file - tmp file: {fp.name} size: {fp.tell()}') - return fp + with http_client.stream("GET", url) as response: + + fp = tempfile.NamedTemporaryFile() + for chunk in response.iter_bytes(): + if chunk: # filter out keep-alive new chunks + fp.write(chunk) + + # log.info(f'Download file - tmp file: {fp.name} size: {fp.tell()}') + return fp def url_path_param_quoting(param):