A Python SDK for searching PubMed using the NCBI E-Utilities
Project description
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')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pubmed_sdk-0.4.tar.gz
.
File metadata
- Download URL: pubmed_sdk-0.4.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3f6f75b275c5dcb126130f625cc2385caece916b8af8eba297921663f1a775c6
|
|
MD5 |
5fce479bb38a72b060e24f9925c8ed57
|
|
BLAKE2b-256 |
b925a357040b0898c85ad31ed27d0caa6111564414e4cde50f694edfedc3716a
|
File details
Details for the file pubmed_sdk-0.4-py3-none-any.whl
.
File metadata
- Download URL: pubmed_sdk-0.4-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bdbc162a4bf678f1bc30259062b7f83e277ff246348acd32442e4148edeb3629
|
|
MD5 |
cd7e01dc6002038a0309c32c3fe184d9
|
|
BLAKE2b-256 |
5dbe43b88c60e410836488ac631b1780ef8413942122f4ee124ba5804de5be21
|