habanero
raw JSON → 2.3.0 verified Fri May 01 auth: no python
Low-level async HTTP client for the Crossref Search API. Current version 2.3.0 supports Python >=3.10. Uses httpx instead of requests, with optional bibtexparser for BibTeX handling.
pip install habanero Common errors
error ImportError: cannot import name 'Crossref' from 'habanero' ↓
cause Incorrect import statement (e.g., from habanero.crossref import Crossref).
fix
Use: from habanero import Crossref
error TimeoutError: The read operation timed out ↓
cause Default timeout in httpx may be insufficient for large queries.
fix
Set timeout when creating Crossref instance: cr = Crossref(timeout=30)
error TypeError: __init__() got an unexpected keyword argument 'ua_string' ↓
cause ua_string parameter was renamed or removed in v2.0.0.
fix
Use the default user-agent or set custom headers via httpx. Remove ua_string.
Warnings
breaking v2.0.0 replaced requests with httpx. Code relying on requests.Session or custom adapters will break. ↓
fix Update any custom HTTP handling; use httpx settings via the client.
deprecated v0.7.4 deprecated query.title filter; use query.bibliographic instead. ↓
fix Replace query.title=... with query.bibliographic=...
gotcha The ids parameter is now required in Crossref.prefixes method (since v1.2.6). Omitting it causes an error. ↓
fix Always pass ids to .prefixes().
breaking bibtexparser is optional since v2.0.0. Code that imports it directly from habanero will fail unless the [bibtex] extra is installed. ↓
fix Install with pip install habanero[bibtex] or handle ImportError gracefully.
Install
pip install habanero[bibtex] Imports
- Crossref
from habanero import Crossref
Quickstart
from habanero import Crossref
cr = Crossref(mailto="your@email.com") # replace with your email
result = cr.works(query="open access", limit=5)
print(result)