Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DGI #35

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ install_requires =
pyyaml
tqdm
bioregistry[align]>=0.10.0
pandas # remove after deploying https://github.com/biopragmatics/bioregistry/pull/1047
lxml
psycopg2-binary

Expand Down
14 changes: 4 additions & 10 deletions src/bioversions/sources/dgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import bs4
import requests

from bioversions.utils import Getter, VersionType
from bioversions.utils import Getter, VersionType, get_soup

DOWNLOADS_PAGE = "https://www.dgidb.org/downloads"

Expand All @@ -21,15 +21,9 @@ class DGIGetter(Getter):

def get(self):
"""Get the latest DGI version number."""
res = requests.get(DOWNLOADS_PAGE)
soup = bs4.BeautifulSoup(res.content, parser="lxml", features="lxml")
cells = list(soup.select("table#tsv_downloads tbody tr:first-child td:nth-child(2) a"))
if 1 != len(cells):
raise ValueError
cell = cells[0]
href = cell["href"]
version = os.path.dirname(os.path.relpath(href, "data/monthly_tsvs"))
return version
soup = get_soup(DOWNLOADS_PAGE)
# need to deconstruct graphql somehow?
raise NotImplementedError


if __name__ == "__main__":
Expand Down
Loading