(doi: str)
| 542 | |
| 543 | |
| 544 | def fetch_crossref_by_doi(doi: str) -> dict[str, Any] | None: |
| 545 | url = f"{CROSSREF_WORKS_URL}/{urllib.parse.quote(doi)}" |
| 546 | try: |
| 547 | data = http_get_json(url, headers={"User-Agent": DEFAULT_USER_AGENT}) |
| 548 | except Exception: |
| 549 | return None |
| 550 | message = data.get("message") or {} |
| 551 | if not isinstance(message, dict): |
| 552 | return None |
| 553 | return normalize_crossref_work(message) |
| 554 | |
| 555 | |
| 556 | def search_crossref_by_title(title: str, *, limit: int = 5) -> list[dict[str, Any]]: |
no test coverage detected