Skip to main content

Python DOI Resolver

Project description

pyDOI -- Python DOI Resolver

badge:pypi-version badge:py-versions pre-commit pre-commit.ci status Code style: black Code style: prettier

Wrapper for the DOI system Proxy Server REST API (see also here).

Usage

In [1]: import pydoi

In [2]: # Get full response

In [3]: pydoi.resolve("10.1002/chem.202000622")
Out[3]:
{'responseCode': 1,
 'handle': '10.1002/chem.202000622',
 'values': [{'index': 1,
   'type': 'URL',
   'data': {'format': 'string',
    'value': 'https://onlinelibrary.wiley.com/doi/10.1002/chem.202000622'},
   'ttl': 86400,
   'timestamp': '2020-09-25T16:02:07Z'},
  {'index': 700050,
   'type': '700050',
   'data': {'format': 'string', 'value': '2020100503563800217'},
   'ttl': 86400,
   'timestamp': '2020-10-05T12:25:43Z'},
  {'index': 100,
   'type': 'HS_ADMIN',
   'data': {'format': 'admin',
    'value': {'handle': '0.na/10.1002',
     'index': 200,
     'permissions': '111111110010'}},
   'ttl': 86400,
   'timestamp': '2020-03-30T02:01:43Z'}]}

In [4]: # Get URL

In [5]: pydoi.get_url("10.1016/j.chempr.2020.04.016")
Out[5]: 'https://linkinghub.elsevier.com/retrieve/pii/S2451929420301844'

In [6]: ## Get URL(s) from "10320/loc" type records

In [7]: pydoi.get_url("10.6567/IFToMM.14TH.WC.OS3.029")
Out[7]: 'https://www.airitilibrary.com/Publication/alDetailedMesh?DocID=P20150909001-201510-201510260026-201510260026-672-680'

In [8]: pydoi.get_url("10.6567/IFToMM.14TH.WC.OS3.029", allow_multi=True)
Out[8]:
['http://www.airitilibrary.cn/Publication/alDetailedMesh?DocID=P20150909001-201510-201510260026-201510260026-672-680',
 'https://www.airitilibrary.com/Publication/alDetailedMesh?DocID=P20150909001-201510-201510260026-201510260026-672-680']

In [9]: # pyDOI supports the use of query parameters

In [10]: pydoi.resolve("10.1002/anie.201804551", params=[("type", "URL")])
Out[10]:
{'responseCode': 1,
 'handle': '10.1002/anie.201804551',
 'values': [{'index': 1,
   'type': 'URL',
   'data': {'format': 'string',
    'value': 'https://onlinelibrary.wiley.com/doi/abs/10.1002/anie.201804551'},
   'ttl': 86400,
   'timestamp': '2020-03-19T11:37:54Z'}]}

In [11]: pydoi.resolve("10.1002/anie.201804551", params=[("type", "HS_ADMIN")])
Out[11]:
{'responseCode': 1,
 'handle': '10.1002/anie.201804551',
 'values': [{'index': 100,
   'type': 'HS_ADMIN',
   'data': {'format': 'admin',
    'value': {'handle': '0.na/10.1002',
     'index': 200,
     'permissions': '111111110010'}},
   'ttl': 86400,
   'timestamp': '2018-05-15T11:31:52Z'}]}

Installation

Installable with pip.

pip install pyDOI

License

GNU General Public License v3.0 or later

See LICENSE for the full text.

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

pyDOI-0.2.0.tar.gz (19.8 kB view hashes)

Uploaded Source

Built Distribution

pyDOI-0.2.0-py3-none-any.whl (16.7 kB view hashes)

Uploaded Python 3

Supported by

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