Downloading Decisions

Download client for data that can be converted to Decision and Opinion objects.

class justopinion.download.CAPClient(api_token='')

Downloads judicial decisions from Case Access Project API.

fetch(query, full_case=False)

Query by CAP id or citation, and download Decision from CAP API.

Return type

Response

read(query, full_case=False)

Query by CAP id or citation, download, and load Decision from CAP API.

Return type

Decision

get_api_headers(full_case=False)

Get API headers based on whether the full case text is requested.

Return type

Dict[str, str]

fetch_cite(cite, full_case=False)

Get the API list response for a queried citation from the CAP API.

Parameters
Return type

Response

Returns

the “results” list for this queried citation.

read_decision_list_by_cite(cite, full_case=False)

Download and deserialize the “results” list for a queried citation from the CAP API.

Parameters
Return type

List[Decision]

Returns

the first case in the “results” list for this queried citation.

read_decisions_from_response(response)

Deserialize a list of cases from the “results” list of a response from the CAP API.

Parameters

response (Response) – a response from the CAP API

Return type

List[Decision]

Returns

all decisions in the “results” list for the response

read_decision_from_response(response)

Deserialize a single case from the “results” list of a response from the CAP API.

Parameters

response (Response) – a response from the CAP API

Return type

Decision

Returns

the first decision in the “results” list for the response

read_cite(cite, full_case=False)

Download and deserialize a Decision from Caselaw Access Project API.

Parameters
Return type

Decision

Returns

the first case in the “results” list for this queried citation.

fetch_id(cap_id, full_case=False)

Download a decision from Caselaw Access Project API.

Parameters
Return type

Response

Returns

the first case in the “results” list for this queried citation.

read_id(cap_id, full_case=False)

Download a decision from Caselaw Access Project API.

Parameters
Return type

Decision

Returns

a Decision created from the first case in the “results” list for this queried citation.

exception justopinion.download.CaseAccessProjectAPIError

Error for failed attempts to use the Case Access Project API.