This Python wrapper grants easy access to the CAPAPI provided by the Caselaw Access Project. It liberates state and federal court cases.
Start by creating a Reporter.
>>>from wheatonpeters import Reporter
>>>wheaton = Reporter()
You can then use your Reporter to make the level API calls and pass in filter arguments. In return, you'll get an object representing the json response.
WheatonPeters adds some useful entries to the top level dictionary, but the
results
list matches the response from the CAPAPI exactly. WheatonPeters will
retrieve up to max_pages
API calls and concatenate the results
of all of
them.
The next
and previous
links are the cursor links from the last page of the
API results. Currently, WheatonPeters only goes forward through results.
>>>response = Reporter.cases(max_pages=5, jurisdiction='alaska', full_case=True, decision_date_min='2001-04-01')
>>>response.keys()
dict_keys(['count', 'results', 'count_included', 'query_url'])
>>>response['count']
1548
>>>response['count_included']
500
>>>response['query_url']
'https://api.case.law/v1/cases/?jurisdiction=alaska&full_case=true&decision_date_min=2001-04-01'
>>>response['results'][0].keys()
dict_keys(['id', 'url', 'name', 'name_abbreviation', 'decision_date', 'docket_number', 'first_page', 'last_page', 'citations', 'volume', 'reporter', 'court', 'jurisdiction', 'casebody'])
- cases
- citations
- jurisdictions
- courts
- volumes
- reporters
- bulk
WheatonPeters is named for a legendary Supreme Court case, Wheaton v. Peters, between two Supreme Court reporters that determined that the text of the Court's decisions could not be restricted by copyright.
I only use Linux, and I'm not personally going to test it on anything else.