Low Level Client for Crossref Search API
Project description
habanero
This is a low level client for working with Crossref’s search API. It’s been named to be more generic, as other organizations are/will adopt Crossref’s search API, making it possible to interact with all from one client.
Other Crossref API clients:
Ruby: serrano, https://github.com/sckott/serrano
Crossref’s API issue tracker: https://crossref.atlassian.net/jira/software/c/projects/CR/issues/
habanero includes three modules you can import as needed (or import all):
Crossref - Crossref search API. The Crossref module includes methods matching Crossref API routes, and a few convenience methods for getting DOI agency and random DOIs:
works - /works route
members - /members route
prefixes - /prefixes route
funders - /funders route
journals - /journals route
types - /types route
licenses - /licenses route
registration_agency - get DOI minting agency
random_dois - get random set of DOIs
counts - citation counts. Includes the single citation_count method
cn - content negotiation. Includes the methods:
content_negotiation - get citations in a variety of formats
csl_styles - get CSL styles, used in content_negotation method
WorksContainer - A class for handling Crossref works. Pass output of works from methods on the Crossref class to more easily extract specific fields of works.
Note about searching:
You are using the Crossref search API described at https://api.crossref.org/swagger-ui/index.html. When you search with query terms, on Crossref servers they are not searching full text, or even abstracts of articles, but only what is available in the data that is returned to you. That is, they search article titles, authors, etc. For some discussion on this, see https://gitlab.com/crossref/issues/-/issues/101
Rate limits
See the headers X-Rate-Limit-Limit and X-Rate-Limit-Interval for current rate limits.
The Polite Pool
To get in the polite pool it’s a good idea now to include a mailto email address. See docs for more information.
Installation
Stable version
# pip
pip install habanero
# uv w/ legacy project setup
uv pip install habanero
# uv w/ pyproject.toml
uv add habanero
If you would like to fix bibtex format citations using content negotiation you’ll have to install the optional dependency bibtexparser >= 2.0.0b7 (done for you with optional [bibtex])
pip install habanero[bibtex]
Dev version
pip install git+https://github.com/sckott/habanero.git#egg=habanero
Or build it yourself locally
git clone https://github.com/sckott/habanero.git
cd habanero
make install
Usage
Initialize a client
from habanero import Crossref
cr = Crossref()
Works route
# query
x = cr.works(query = "ecology")
x['message']
x['message']['total-results']
x['message']['items']
# fetch data by DOI
cr.works(ids = '10.1371/journal.pone.0033693')
Members route
# ids here is the Crossref Member ID; 98 = Hindawi
cr.members(ids = 98, works = True)
Citation counts
from habanero import counts
counts.citation_count(doi = "10.1016/j.fbr.2012.01.001")
Content negotiation - get citations in many formats
from habanero import cn
cn.content_negotiation(ids = '10.1126/science.169.3946.635')
cn.content_negotiation(ids = '10.1126/science.169.3946.635', format = "citeproc-json")
cn.content_negotiation(ids = "10.1126/science.169.3946.635", format = "rdf-xml")
cn.content_negotiation(ids = "10.1126/science.169.3946.635", format = "text")
cn.content_negotiation(ids = "10.1126/science.169.3946.635", format = "text", style = "apa")
cn.content_negotiation(ids = "10.1126/science.169.3946.635", format = "bibentry")
Meta
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
License: MIT; see LICENSE file
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file habanero-2.3.0.tar.gz.
File metadata
- Download URL: habanero-2.3.0.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
871e5d088ef641b05514d44b004af512852b309bcd0d81f10545e58d54a654ab
|
|
| MD5 |
415d0e17fa21438d14cac52297760c28
|
|
| BLAKE2b-256 |
7e79e1463d0829f1b9d9a140ea78dda9461c13a8d9589797ab1ff5b7fffd133f
|
Provenance
The following attestation bundles were made for habanero-2.3.0.tar.gz:
Publisher:
publish.yml on sckott/habanero
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
habanero-2.3.0.tar.gz -
Subject digest:
871e5d088ef641b05514d44b004af512852b309bcd0d81f10545e58d54a654ab - Sigstore transparency entry: 231090535
- Sigstore integration time:
-
Permalink:
sckott/habanero@1d0fad344f7f7560bade60b34fdadf52b660d3db -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/sckott
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d0fad344f7f7560bade60b34fdadf52b660d3db -
Trigger Event:
release
-
Statement type:
File details
Details for the file habanero-2.3.0-py3-none-any.whl.
File metadata
- Download URL: habanero-2.3.0-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba44dd33d562ff33bd778fd7f94bfac3bf805b0b0963976f379e0a1d6894329e
|
|
| MD5 |
ff5d196c1a1135ae8214f7276330e351
|
|
| BLAKE2b-256 |
a9763e7d4c17024e70b1be20623937bde945842480b84d6f7dd49bd0ef372d84
|
Provenance
The following attestation bundles were made for habanero-2.3.0-py3-none-any.whl:
Publisher:
publish.yml on sckott/habanero
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
habanero-2.3.0-py3-none-any.whl -
Subject digest:
ba44dd33d562ff33bd778fd7f94bfac3bf805b0b0963976f379e0a1d6894329e - Sigstore transparency entry: 231090540
- Sigstore integration time:
-
Permalink:
sckott/habanero@1d0fad344f7f7560bade60b34fdadf52b660d3db -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/sckott
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d0fad344f7f7560bade60b34fdadf52b660d3db -
Trigger Event:
release
-
Statement type: