@@ -0,0 +1,1652 @@
+%22%22%22Client to COCI, the OpenCitations Index of Crossref open DOI-to-DOI citations.%0A%0AFor more information on the COCI, see: https://opencitations.net/index/coci%0Awith API documentation at https://opencitations.net/index/coci/api/v1/.%0A%22%22%22%0A__all__ = %5B'get_citation_count_for_doi', 'get_citation_count_for_pmid'%5D%0A%0Afrom typing import Union%0Aimport requests%0Afrom indra.literature.crossref_client import doi_query%0A%0A%0Acoci_url = 'https://opencitations.net/index/coci/api/v1/'%0Acitation_count_url = coci_url + 'citation-count/'%0A%0A%0Adef get_citation_count_for_doi(doi: str) -%3E int:%0A    %22%22%22Return the citation count for a given DOI.%0A%0A    Note that the COCI API returns a count of 0 for DOIs that are not%0A    indexed.%0A%0A    Parameters%0A    ----------%0A    doi :%0A        The DOI to get the citation count for.%0A%0A    Returns%0A    -------%0A    :%0A        The citation count for the DOI.%0A    %22%22%22%0A%0A    url = citation_count_url + doi%0A    res = requests.get(url)%0A    res.raise_for_status()%0A    return int(res.json()%5B0%5D%5B'count'%5D)%0A%0A%0Adef get_citation_count_for_pmid(pmid: str) -%3E Union%5Bint, None%5D:%0A    %22%22%22Return the citation count for a given PMID.%0A%0A    This uses the CrossRef API to get the DOI for the PMID, and then%0A    calls the COCI API to get the citation count for the DOI.%0A%0A    If the DOI lookup failed, this returns None. Note that%0A    the COCI API returns a count of 0 for DOIs that are not%0A    indexed.%0A%0A    Parameters%0A    ----------%0A    pmid :%0A        The PMID to get the citation count for.%0A%0A    Returns%0A    -------%0A    :%0A        The citation count for the PMID.%0A    %22%22%22%0A    doi = doi_query(pmid)%0A    if not doi:%0A        return None%0A    return get_citation_count_for_doi(doi)

Add COCI client