Skip to content

Commit

Permalink
Requests to httpx changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wshayes committed Mar 25, 2020
1 parent 4e8ec99 commit 87b0a79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Expand Up @@ -2,6 +2,7 @@
"peacock.color": "#81ec64",
"workbench.colorCustomizations": {
"activityBar.background": "#a6f291",
"activityBar.activeBackground": "#a6f291",
"activityBar.activeBorder": "#708cee",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
Expand Down
4 changes: 2 additions & 2 deletions bel/edge/pipeline.py
Expand Up @@ -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()

Expand Down Expand Up @@ -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)

Expand Down
17 changes: 9 additions & 8 deletions bel/utils.py
Expand Up @@ -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):
Expand Down

0 comments on commit 87b0a79

Please sign in to comment.