Skip to content

Commit

Permalink
Fixed bug in fetch_sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
itrujnara committed May 13, 2024
1 parent a1a65eb commit 78f2e1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions bin/fetch_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def fetch_seqs_oma(path: str, prefix: str) -> list[str]:

payload = {"ids": ids}

print(payload, file=sys.stderr)

res = safe_post("https://omabrowser.org/api/protein/bulk_retrieve/", json=payload)

if not res.ok:
Expand Down
4 changes: 2 additions & 2 deletions bin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def safe_get(url: str):
raise RequestException(f"A network issue occurred. Retrying request. Details:\n{e}")


def safe_post(url: str, data: dict):
def safe_post(url: str, data: dict = dict(), json: dict = dict()):
"""
Post data to a URL and return the response.
"""
try:
return requests.post(url, data=data)
return requests.post(url, data=data, json=json)
except requests.exceptions.RequestException as e:
raise RequestException(f"A network issue occurred. Retrying request. Details:\n{e}")

Expand Down

0 comments on commit 78f2e1e

Please sign in to comment.