Writers

Functions for saving objects to file after they have been JSON serialized.

authorityspoke.io.writers.case_to_file(case, filename=None, directory=None, filepath=None)

Save one case from an API response as a JSON file.

Parameters
  • results – A dict representing a case, in the format of the Caselaw Access Project API.

  • filename (Optional[str]) – Filename (not including the directory) for the file where the downloaded opinion should be saved.

  • directory (Optional[Path]) – A Path object specifying the directory where the downloaded opinion should be saved. If None is given, the current default is example_data/cases.

  • filepath (Optional[Path]) – Complete path to the location where the JSON file should be saved, including filename.

Return type

None