From 4a46731aff6804eff3d2ddd711def975a60b51fe Mon Sep 17 00:00:00 2001 From: James Braza Date: Mon, 30 Oct 2023 15:31:59 -0700 Subject: [PATCH 1/2] Expanded examples of DOI existence checks --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 12f188d..1b5662a 100644 --- a/README.md +++ b/README.md @@ -269,7 +269,7 @@ When searching GWAS catalog PMID is needed over DOI. You can covert one to the o ```python def doi_term(doi: str) -> str: - """Prepare DOI for PubMed search""" + """Clean a DOI string by removing URL prefix.""" doi = ( doi .replace('http://', 'https://') @@ -283,27 +283,31 @@ result = entrez_api.search( database='pubmed', max_results=1 ) -result.data['esearchresult']['idlist'] +try: + print(result.data['esearchresult']['idlist']) +except KeyError as exc: + raise ValueError( + f"Unexpected response data blob {result.data}." + ) from exc ``` > `['33834021']` ### Installation -Requires Python 3.6+. Install with: - +Requires Python 3.6+ (though only 3.7+ is tested). Install with: ```bash pip install easy-entrez ``` -If you wish to enable (optional, tqdm-based) progress bars use: +If you wish to enable (optional, `tqdm`-based) progress bars use: ```bash pip install easy-entrez[with_progress_bars] ``` -If you wish to enable (optional, pandas-based) parsing utilities use: +If you wish to enable (optional, `pandas`-based) parsing utilities use: ```bash pip install easy-entrez[with_parsing_utils] From e5763ad9722fe86720b5f9d794d8f4e5a80eb1e1 Mon Sep 17 00:00:00 2001 From: James Braza Date: Wed, 1 Nov 2023 08:20:08 -0700 Subject: [PATCH 2/2] Removed try-except added --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 1b5662a..4b26c0b 100644 --- a/README.md +++ b/README.md @@ -283,12 +283,7 @@ result = entrez_api.search( database='pubmed', max_results=1 ) -try: - print(result.data['esearchresult']['idlist']) -except KeyError as exc: - raise ValueError( - f"Unexpected response data blob {result.data}." - ) from exc +print(result.data['esearchresult']['idlist']) ``` > `['33834021']`