pubmed-sdk


Namepubmed-sdk JSON
Version 0.4 PyPI version JSON
download
home_pagehttp://github.com/pubmed-ai/pubmed_sdk
SummaryA Python SDK for searching PubMed using the NCBI E-Utilities
upload_time2023-06-19 20:14:42
maintainer
docs_urlNone
authorLeo Sternlicht
requires_python>=3.6
licenseMIT
keywords pubmed ncbi e-utilities sdk pubmed api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pubmed-sdk
python SDK for searching PubMed 

# pubmed_sdk

[![PyPI version](https://badge.fury.io/py/pubmed_sdk.svg)](https://badge.fury.io/py/pubmed_sdk)
![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)
![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)
![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)
![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)
![Build Status](https://travis-ci.org/yourusername/pubmed_sdk.svg?branch=master)

Pubmed_SDK is a Python client library for searching PubMed using the NCBI E-Utilities.

- [Examples](#examples)
- [About Pubmed_sdk](#about)
- [Usage](#usage)


## 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

```terminal
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:

```python
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:

```python
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:

```python
for detail in details:
    article = detail['MedlineCitation']['Article']
    print(article['ArticleTitle'])
    print(article['Abstract']['AbstractText'], '\n\n')
```

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/pubmed-ai/pubmed_sdk",
    "name": "pubmed-sdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "pubmed ncbi e-utilities sdk,pubmed api",
    "author": "Leo Sternlicht",
    "author_email": "lsternlicht@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b9/25/a357040b0898c85ad31ed27d0caa6111564414e4cde50f694edfedc3716a/pubmed_sdk-0.4.tar.gz",
    "platform": null,
    "description": "# pubmed-sdk\npython SDK for searching PubMed \n\n# pubmed_sdk\n\n[![PyPI version](https://badge.fury.io/py/pubmed_sdk.svg)](https://badge.fury.io/py/pubmed_sdk)\n![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)\n![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)\n![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)\n![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)\n![Build Status](https://travis-ci.org/yourusername/pubmed_sdk.svg?branch=master)\n\nPubmed_SDK is a Python client library for searching PubMed using the NCBI E-Utilities.\n\n- [Examples](#examples)\n- [About Pubmed_sdk](#about)\n- [Usage](#usage)\n\n\n## About Pubmed_sdk\n\nPubmed_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.\n\n## Installation\n\n```terminal\npip install pubmed_sdk\n```\n\n## Usage\n\n### Search PubMed\nYou can search PubMed by creating a `PubMed` object and calling the `search` method with your search term:\n\n```python\nfrom pubmed_sdk import PubMed\n\npubmed = PubMed()\nresults = pubmed.search('COVID-19')\n```\n\n\nThe `search` method supports the following parameters:\n\n* **term**: The search term.\n* **db**: The database to search (default is 'pubmed').\n* **retmax**: The maximum number of results to return (default is 20).\n* **usehistory**: Whether to use the NCBI history feature (default is 'y').\n\n\n### Fetch Article Details\nAfter searching, you can fetch the details of the articles using the fetch_details method:\n\n```python\nid_list = results['id_list']    # ['33725716', '33725717']\ndetails = pubmed.fetch_details(id_list).get('PubmedArticle')\n```\n\nThis method accepts a list of IDs and returns a list of dictionaries containing the details of each article.\n\nHere's an example of how to iterate through the results and print some information about each article:\n\n```python\nfor detail in details:\n    article = detail['MedlineCitation']['Article']\n    print(article['ArticleTitle'])\n    print(article['Abstract']['AbstractText'], '\\n\\n')\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python SDK for searching PubMed using the NCBI E-Utilities",
    "version": "0.4",
    "project_urls": {
        "Homepage": "http://github.com/pubmed-ai/pubmed_sdk"
    },
    "split_keywords": [
        "pubmed ncbi e-utilities sdk",
        "pubmed api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5dbe43b88c60e410836488ac631b1780ef8413942122f4ee124ba5804de5be21",
                "md5": "cd7e01dc6002038a0309c32c3fe184d9",
                "sha256": "bdbc162a4bf678f1bc30259062b7f83e277ff246348acd32442e4148edeb3629"
            },
            "downloads": -1,
            "filename": "pubmed_sdk-0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd7e01dc6002038a0309c32c3fe184d9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4695,
            "upload_time": "2023-06-19T20:14:40",
            "upload_time_iso_8601": "2023-06-19T20:14:40.898253Z",
            "url": "https://files.pythonhosted.org/packages/5d/be/43b88c60e410836488ac631b1780ef8413942122f4ee124ba5804de5be21/pubmed_sdk-0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b925a357040b0898c85ad31ed27d0caa6111564414e4cde50f694edfedc3716a",
                "md5": "5fce479bb38a72b060e24f9925c8ed57",
                "sha256": "3f6f75b275c5dcb126130f625cc2385caece916b8af8eba297921663f1a775c6"
            },
            "downloads": -1,
            "filename": "pubmed_sdk-0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "5fce479bb38a72b060e24f9925c8ed57",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4514,
            "upload_time": "2023-06-19T20:14:42",
            "upload_time_iso_8601": "2023-06-19T20:14:42.185488Z",
            "url": "https://files.pythonhosted.org/packages/b9/25/a357040b0898c85ad31ed27d0caa6111564414e4cde50f694edfedc3716a/pubmed_sdk-0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-19 20:14:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pubmed-ai",
    "github_project": "pubmed_sdk",
    "github_not_found": true,
    "lcname": "pubmed-sdk"
}
        
Elapsed time: 0.08022s