Skip to main content

NOTE: This is a user-maintained extension of the pymed project which was archived in 2020. Some bugs in pymed are fixed here. This package can be installed via pip install pymed-paperscraper since I forked it to support paperscraper.

License: MIT PyPI version Downloads Downloads

PyMed - PubMed Access through Python

PyMed is a Python library that provides access to PubMed through the PubMed API.

Why this library?

The PubMed API is not very well documented and querying it in a performant way is too complicated and time consuming for researchers. This wrapper provides access to the API in a consistent, readable and performant way.

Features

This library takes care of the following for you:

  • Querying the PubMed database (with the standard PubMed query language)
  • Batching of requests for better performance
  • Parsing and cleaning of the retrieved articles

Examples

For full (working) examples have a look at the examples/ folder in this repository. In essence you only need to import the PubMed class, instantiate it, and use it to query:

from pymed_paperscraper import PubMed
pubmed = PubMed(tool="MyTool", email="my@email.address")
results = pubmed.query("Some query", max_results=500)

Bugfixes compared to archived pymed:

  • Article IDs are correctly extracted pymed#22
  • Automatic retries if API is unresponsive/overloaded. Support for max_tries in PubMed class.
  • Titles and abstracts no longer get truncated when PubMed XML contains inline formatting tags such as italics.

Notes on the API

The original documentation of the PubMed API can be found here: PubMed Central. PubMed Central kindly requests you to:

  • Do not make concurrent requests, even at off-peak times; and
  • Include two parameters that help to identify your service or application to our servers
    • tool should be the name of the application, as a string value with no internal spaces, and
    • email should be the e-mail address of the maintainer of the tool, and should be a valid e-mail address.

Citation

If you use pymed_paperscraper in your work, please cite:

(Citation follows)

Release files for pymed-paperscraper 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymed-paperscraper 1.0.6
File Size Uploaded
pymed_paperscraper-1.0.6.tar.gz 284.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymed-paperscraper 1.0.6
File Interpreter ABI Platform
pymed_paperscraper-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 295.8 kB

Release files / pymed_paperscraper-1.0.6.tar.gz

Download URL pymed_paperscraper-1.0.6.tar.gz
Size 284.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3ca2297572e60f667b6c9962c1a88bd1cb656f241d72cdd802dffe6aabe22de7
BLAKE2b-256 checksum
How to use checksums
f60daf0e31b4134903ec327c901e2c837219483fa8d7b0be21699d12b2a93807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / pymed_paperscraper-1.0.6-py3-none-any.whl

Download URL pymed_paperscraper-1.0.6-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f6daa07ad6ce13be765b308b968276e7f5bc174203fd7d6e2f3fd3ef235817e
BLAKE2b-256 checksum
How to use checksums
812002923c147f74a9206a60e56be4ab303ae8e357245c760cd42b3fb1c7fba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page