UnOffical Python Crossref.org API Wrapper and CLI.
pip install crossref
git clone https://github.com/TralahM/academic_citations
cd academic_citations
python setup.py bdist_wheel
pip install -e .
$ crossref --help
$ crossref pubs --help
$ crossref journals --help
$ crossref members --help
$ crossref funders --help
$ crossref cite --help
$ crossref works --query "Machine learning" --rows 20
$ crossref work 10.5621/sciefictstud.40.2.0382
$ crossref funders --query "Machine learning" --rows 20
$ crossref funders get 100000003
$ crossref members --query "Machine learning" --rows 20
$ crossref members get 1
$ crossref journals --query "Machine learning" --rows 20
$ crossref journals get 2167-8359
crossref --help
usage: crossref [-h] [--mailto MAILTO] [--auth-token AUTH_TOKEN]
[--api-version API_VERSION] [-o OUTFILE] [--rows ROWS]
[--format-on]
[--sample SAMPLE | --offset OFFSET | --cursor CURSOR]
{pubs,works,publications,w,p,journals,journal,jnl,j,members,member,m,funders,funder,f,types,type,t,licenses,license,lc,lcs,cite,citation,citations,ref,refs,reference,references,prefix,pre,px}
...
options:
-h, --help show this help message and exit
--mailto MAILTO mailto address for polite users
--auth-token AUTH_TOKEN
auth token for authenticated (Plus) users
--api-version API_VERSION
API version to use (default=v1)
-o OUTFILE Json filename to also store the output
--rows ROWS Number of Rows to return (default=20)
--format-on Format json output using pygments syntax highlighting?
--sample SAMPLE Sample size
--offset OFFSET Offset
--cursor CURSOR Cursor parameter
commands:
{pubs,works,publications,w,p,journals,journal,jnl,j,members,member,m,funders,funder,f,types,type,t,licenses,license,lc,lcs,cite,citation,citations,ref,refs,reference,references,prefix,pre,px}
pubs (works, publications, w, p)
Interact with the Works API. Supports the following
parameters: - Queries: (query) and (query.field(s)) -
Filters: (filter=type-name:filter)(s) or dot filters
(filter=type-name.field-name:filter)(s) - Pagination
with offsets: (offset) and (rows) - Deep paging:
(cursor=*) initially and (cursor=next-cursor) in
subsequent requests - Elements: (select=field-name(s))
- Sort: (sort) and (order) - Facets: (facet=type-
name:*) - Sample: (sample) And returns a list of works
(journal articles, conference proceedings, books,
components, etc), or a single work (if you specify a
DOI).
journals (journal, jnl, j)
Interact with the Journals API. Supports the following
parameters: - Queries: (query) and (query.field(s)) -
Pagination with offsets: (offset) and (rows) - Deep
paging: (cursor=*) initially and (cursor=next-cursor)
in subsequent requests
members (member, m)
Interact with the Members API. Supports the following
parameters: - Queries: (query) and (query.field(s)) -
Pagination with offsets: (offset) and (rows) - Deep
paging: (cursor=*) initially and (cursor=next-cursor)
in subsequent requests - Filters: (filter=type-
name:filter)(s) or dot filters (filter=type-
name.field-name:filter)(s)
funders (funder, f)
Interact with the Funders API. Supports the following
parameters: - Queries: (query) and (query.field(s)) -
Pagination with offsets: (offset) and (rows) - Deep
paging: (cursor=*) initially and (cursor=next-cursor)
in subsequent requests - Filters:
(filter=location:filter) - location = funders located
in given country
types (type, t) Interact with the Types API. Supports the following
parameters: - Pagination with offsets: (offset) and
(rows)
licenses (license, lc, lcs)
Interact with the Licenses API. Supports the following
parameters: - Queries: (query) and (query.field(s)) -
Pagination with offsets: (offset) and (rows) - Deep
paging: (cursor=*) initially and (cursor=next-cursor)
in subsequent requests
cite (citation, citations, ref, refs, reference, references)
Get Citation/ Reference Text of the given DOI In the
Specified Style (apa, mla, bibtex, etc).
prefix (pre, px) Interact with the Types API. Supports the following
parameters: - Pagination with offsets: (offset) and
(rows)
Author: Tralah M Brian (TralahM) <briantralah@gmail.com>. Project:
<https://github.com/TralahM/academic_citations>
from crossref import CrossrefAPIClient
client = CrossrefAPIClient()
works = client.get_works(
{
"rows": 20,
"query": "Machine learning",
}
)
print(works.json())
work = client.get_work("10.5621/sciefictstud.40.2.0382")
print(work.json())
funders = client.get_funders(
{
"rows": 20,
"query": "Machine learning",
}
)
print(funders.json())
funder = client.get_funder("100000003")
print(funder.json())
members = client.get_members(
{
"rows": 20,
"query": "Machine learning",
}
)
print(members.json())
member = client.get_member("1")
journals = client.get_journals(
{
"rows": 20,
"query": "Machine learning",
}
)
print(journals.json())
journal = client.get_journal("2167-8359")
print(journal.json())
types = client.get_types(
{
"rows": 20,
"query": "Machine learning",
}
)
print(types.json())
type = client.get_type("journal-article")
print(type.json())
licenses = client.get_licenses(
{
"rows": 20,
"query": "Machine learning",
}
)
print(licenses.json())
prefix = client.get_prefix("10.1038")
print(prefix.json())
citation = client.get_work_reference("10.5621/sciefictstud.40.2.0382",style="apa")
print(citation.text)
citation = client.get_work_reference("10.5621/sciefictstud.40.2.0382",style="bibtex")
print(citation.text)
citation = client.get_work_reference("10.5621/sciefictstud.40.2.0382",style="mla")
print(citation.text)