pubmed-sdk
python SDK for searching PubMed
pubmed_sdk
Pubmed_SDK is a Python client library for searching PubMed using the NCBI E-Utilities.
About Pubmed_sdk
Pubmed_SDK is a Python SDK that facilitates searching PubMed and retrieving article details using the NCBI E-Utilities. It abstracts the process of making HTTP requests to the E-Utilities API and parsing the XML responses, making it easier to focus on the data itself.
Installation
pip install pubmed_sdk
Usage
Search PubMed
You can search PubMed by creating a PubMed object and calling the search method with your search term:
from pubmed_sdk import PubMed
pubmed = PubMed()
results = pubmed.search('COVID-19')
The search method supports the following parameters:
- term: The search term.
- db: The database to search (default is 'pubmed').
- retmax: The maximum number of results to return (default is 20).
- usehistory: Whether to use the NCBI history feature (default is 'y').
Fetch Article Details
After searching, you can fetch the details of the articles using the fetch_details method:
id_list = results['id_list'] # ['33725716', '33725717']
details = pubmed.fetch_details(id_list).get('PubmedArticle')
This method accepts a list of IDs and returns a list of dictionaries containing the details of each article.
Here's an example of how to iterate through the results and print some information about each article:
for detail in details:
article = detail['MedlineCitation']['Article']
print(article['ArticleTitle'])
print(article['Abstract']['AbstractText'], '\n\n')
Release files for pubmed-sdk 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pubmed_sdk-0.4.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pubmed_sdk-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / pubmed_sdk-0.4.tar.gz
| Download URL | pubmed_sdk-0.4.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f6f75b275c5dcb126130f625cc2385caece916b8af8eba297921663f1a775c6
|
|
BLAKE2b-256 checksum How to use checksums |
b925a357040b0898c85ad31ed27d0caa6111564414e4cde50f694edfedc3716a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / pubmed_sdk-0.4-py3-none-any.whl
| Download URL | pubmed_sdk-0.4-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdbc162a4bf678f1bc30259062b7f83e277ff246348acd32442e4148edeb3629
|
|
BLAKE2b-256 checksum How to use checksums |
5dbe43b88c60e410836488ac631b1780ef8413942122f4ee124ba5804de5be21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|