Downloads

Downloading data that can be converted to authorityspoke objects.

exception authorityspoke.io.downloads.AuthoritySpokeAPIError

Error for invalid API query.

authorityspoke.io.downloads.normalize_case_cite(cite)

Get just the text that identifies a citation.

Return type

str

class authorityspoke.io.downloads.CAPClient(api_token='')

Downloads Decisions from Case Access Project API.

get_api_headers(full_case=<class 'bool'>)

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

Return type

Dict[str, str]

fetch_decision_list_by_cite(cite, full_case=False)

Get the “results” list for a queried citation from the CAP API.

Parameters
  • cite (Union[str, CaseCitation, CAPCitation]) – a citation linked to an opinion in the Caselaw Access Project database. Usually these will be in the traditional format [Volume Number] [Reporter Name Abbreviation] [Page Number], e.g. 750 F.3d 1339 for Oracle America, Inc. v. Google Inc.

  • full_case (bool) – whether to request the full text of the opinion from the Caselaw Access Project API. If this is True, the CAPClient must have the api_token attribute.

Return type

List[Dict[str, Union[str, int, Sequence[Dict[str, str]]]]]

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
  • cite (Union[str, CaseCitation, CAPCitation]) –

    a citation linked to an opinion in the Caselaw Access Project database. Usually these will be in the traditional format [Volume Number] [Reporter Name Abbreviation] [Page Number], e.g. 750 F.3d 1339 for Oracle America, Inc. v. Google Inc.

  • full_case (bool) –

    whether to request the full text of the opinion from the Caselaw Access Project API. If this is True, the CAPClient must have the api_token attribute.

Return type

Decision

Returns

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

fetch_cite(cite, full_case=False)

Download a decision from Caselaw Access Project API.

Parameters
  • cite (Union[str, CaseCitation, CAPCitation]) –

    a citation linked to an opinion in the Caselaw Access Project database. Usually these will be in the traditional format [Volume Number] [Reporter Name Abbreviation] [Page Number], e.g. 750 F.3d 1339 for Oracle America, Inc. v. Google Inc.

  • full_case (bool) –

    whether to request the full text of the opinion from the Caselaw Access Project API. If this is True, the CAPClient must have the api_token attribute.

Return type

Dict[str, Union[str, int, Sequence[Dict[str, str]]]]

Returns

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

read_cite(cite, full_case=False)

Download and deserialize a Decision from Caselaw Access Project API.

Parameters
  • cite (Union[str, CaseCitation, CAPCitation]) –

    a citation linked to an opinion in the Caselaw Access Project database. Usually these will be in the traditional format [Volume Number] [Reporter Name Abbreviation] [Page Number], e.g. 750 F.3d 1339 for Oracle America, Inc. v. Google Inc.

  • full_case (bool) –

    whether to request the full text of the opinion from the Caselaw Access Project API. If this is True, the CAPClient must have the api_token attribute.

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

Dict[str, Union[str, int, Sequence[Dict[str, str]]]]

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.

fetch(query, full_case=False)

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

Return type

Dict[str, Union[str, int, Sequence[Dict[str, str]]]]

read(query, full_case=False)

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

Return type

Decision

class authorityspoke.io.fake_enactments.FakeClient(responses)

Repository for mocking API responses locally.

Imitates the interface of legislice.download.Client

fetch(query, date='')

Fetches data about legislation at specified path and date from Client’s assigned API root.

Parameters
  • path – A path to the desired legislation section using the United States Legislation Markup tree-like citation format. Examples: /us/const/amendment/IV, /us/usc/t17/s103

  • date (Union[date, str]) – A date when the desired version of the legislation was in effect. This does not need to be the “effective date” or the first date when the version was in effect. However, if you select a date when two versions of the provision were in effect at the same time, you will be given the version that became effective later.

Return type

Dict[str, Any]

Returns

A fake JSON response in the format of the Legislice API.

read(query, date='')

Use text expansion, unlike a real client.

Return type

Enactment