Skip to main content

Client for downloading Article PDFs from Wiley's TDM API

Project description

wiley-tdm

Python License Dependencies Version

Table of Contents

Text and Data Mining (TDM)

To learn more about the TDM service and request a TDM Token visit our TDM resources page

Wiley TDM Client

The Wiley TDM Client is a Python package (installable via pip) that aims to simplify interaction with Wiley's TDM API.

Features

The Wiley TDM Client has the following capabilities:

  • PDF Downloads - Download PDFs from Wiley's TDM API
    • Single or bulk PDF downloads
    • Configurable download directory
    • Automatic DOI-based file naming
  • DOI Validation
    • Wiley DOI verification
    • Invalid DOI detection
    • DOI URL encoding
  • API Handling
    • Authentication (API token & IP based auth)
    • Rate limiting support
    • Error handling (e.g. Access denied)
  • Reporting
    • CSV export of download results
    • API status
    • File sizes and download durations
  • Efficiency
    • API Session handling
    • Low memory utilization with PDF streaming
    • Graceful timeouts

Requirements

You will require the following:

Quick Start

Environment Variables

Set the environment variable TDM_API_TOKEN to your API token:

Linux example

# Set your TDM API token (required)
export TDM_API_TOKEN='your-api-token-here'
echo $TDM_API_TOKEN

Install

Install the Wiley TDM package in a Virtual Environment using pip. We always recommend running in a Virtual Environment so as not to clash with existing System Python libraries:

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate

# Install package
(venv) $ pip install wiley-tdm

# Verify installation
(venv) $ pip list | grep wiley-tdm

Basic Usage

The following examples will download Article PDFs to a 'downloads' directory, and name the files <doi>.pdf. All file & directory paths are relative to your current working directory (pwd). Run all code in your Virtual Environment.

Initialize client

from wiley_tdm import TDMClient

# Uses TDM_API_TOKEN from environment
tdm = TDMClient()

Download Single PDF

tdm.download_pdf("10.1111/jtsb.12390")

Download Multiple PDFs

tdm.download_pdfs(["10.1111/jtsb.12390", "10.1111/jlse.12141"])

Download Multiple PDFs, DOIs listed in a file

tdm.download_pdfs("dois.txt")

More examples

See more examples.

Troubleshooting

In most troubleshooting scenarios it can be helpful to generate a report:

# Save the download results to a CSV file: 'results.csv'
tdm.save_results()

Installation

If you encounter installation issues:

# Ensure you're using Python 3.9+
python3 --version

# Update pip to latest version
python3 -m pip install --upgrade pip

Alternatively, try installing a fresh Virtual Environment.

If problems persist, please open an issue with:

  • Your Python version
  • The exact error message
  • Your operating system details

Access denied

Check access directly on Wiley Online Library.

  • If access denied: contact your Institution/Wiley and check your subscription is active.
  • If access granted: ensure you are accessing the TDM API from a known IP address (see below).

It is possible that the IP address you are accessing WOL from is different to where you are running your TDM code. Observe your IP address in the TDM console log and compare to the IP address in your browser.

Example console output:

2025-02-13 11:48:30,762 - INFO - Your IP address, used to check entitlements: XX.XX.XX.XX

Example Browser output:

// https://api.ipify.org/?format=json
{
  "ip": "XX.XX.XX.XX"
}

If problems persist, please contact: tdm@wiley.com

Contributing

We welcome contributions! Please see our Contributing Guide for further details.

License

Distributed under the MIT License. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wiley_tdm-1.0.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wiley_tdm-1.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file wiley_tdm-1.0.0.tar.gz.

File metadata

  • Download URL: wiley_tdm-1.0.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for wiley_tdm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b26358238798f2b2e9f00fbee007fbe674b3d85079503977ec75e4bdd175b945
MD5 3018b3efaf4ddf62f8ac36c512e346d9
BLAKE2b-256 fff47640fef63b21fe1aec97de5c9780029d49cc168cd8664af4cba3b22ee450

See more details on using hashes here.

File details

Details for the file wiley_tdm-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: wiley_tdm-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for wiley_tdm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a748d30c5f5d6da9fb7e46506616fc2cd54d472676bbb5145a168038a400b557
MD5 5ccd58dc217e13d871689beec008e71f
BLAKE2b-256 f8861e05eed026fa3400fd7b827810b6549cf5f67ce28602206f391eca847d2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page