Metadata-Version: 2.2
Name: justopinion
Version: 0.4.0
Summary: Download client for legal opinions
Home-page: https://github.com/mscarey/justopinion
Author: Matt Carey
Author-email: matt@authorityspoke.com
Project-URL: Bug Tracker, https://github.com/mscarey/justopinion/issues
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: License :: Free To Use But Restricted
Classifier: Natural Language :: English
Requires-Python: >=3.11
Description-Content-Type: text/x-rst
Requires-Dist: requests~=2.31.0
Requires-Dist: anchorpoint~=0.8.2
Requires-Dist: eyecite~=2.6.3
Requires-Dist: pydantic>=2.4.2
Requires-Dist: python-dotenv
Requires-Dist: python-ranges~=1.2.2
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

Justopinion
===========

A Python library for downloading and researching legal opinions
using the `Caselaw Access Project API`_. Note that new CAP accounts
are no longer available and the CAP API was sunset on September 1, 2024.

.. image:: https://img.shields.io/badge/open-ethical-%234baaaa
    :target: https://ethicalsource.dev/licenses/
    :alt: An Ethical Open Source Project

.. image:: https://coveralls.io/repos/github/mscarey/justopinion/badge.svg?branch=master
    :target: https://coveralls.io/github/mscarey/justopinion?branch=master
    :alt: Test Coverage Percentage

.. image:: https://github.com/mscarey/justopinion/actions/workflows/python-package.yml/badge.svg
    :target: https://github.com/mscarey/justopinion/actions
    :alt: GitHub Actions Workflow

.. image:: https://readthedocs.org/projects/justopinion/badge/?version=latest
    :target: https://justopinion.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://img.shields.io/pypi/pyversions/justopinion
    :target: https://pypi.org/project/legislice/
    :alt: PyPI - Python Version

Examples
--------

In this example, Justopinion is used to download the decision with the citation `1 Breese 34`.

    >>> import os
    >>> from justopinion import CAPClient
    >>> client = CAPClient(api_token=os.getenv("YOUR_SECRET_API_TOKEN"))
    >>> thornton = client.read_cite("1 Breese 34", full_case=True)
    >>> thornton.casebody.data.parties[0]
    'John Thornton and others, Appellants, v. George Smiley and John Bradshaw, Appellees.'

You can also use Justopinion to locate text in an opinion:

    >>> thornton.opinions[0].locate_text("The court knows of no power in the administrator")
    TextPositionSet{TextPositionSelector[22, 70)}

Or to get the text from a specified location in the opinion:

    >>> selection = thornton.opinions[0].select_text([(258, 294), (312, 359)])
    >>> str(selection)
    '…The note was made to West alone, and…the suit should have been commenced in his name…'

And you can use Justopinion to follow citations in an opinion and download the cited cases:

    >>> str(thornton.cites_to[0])
    'Citation to 15 Ill., 284'
    >>> cited = client.read_cite(thornton.cites_to[0], full_case=True)
    >>> str(cited)
    'Marsh v. People, 15 Ill. 284 (1853-12-01)'

.. _Caselaw Access Project API: https://api.case.law/v1/
