Skip to main content

Python client for the JUDILIBRE public API

Project description

pyJudilibre

pyJudilibreis a small Python wrapper to query theJUDILIBREAPI from the French Supreme Court, la Cour de cassation.JUDILIBRE` aims to give access to judiciary decisions.

01 - Requirements

In order to use this library, you need credentials from https://piste.gouv.fr/. You can find tutorials here on how to get them.

02 - Installation

To install pyJudilibre, you can use pip:

pip install pyjudilibre

It has three different extras:

  • [dev] with development libraries
  • [test] with test libraries
  • [build] with build libraries

03 - Usage

The main class of this library is JudilibreClient. It serves as an interface for the whole API. It has the following methods:

  • healthcheck: returns the availability of the API
  • decision: returns a decision based on its ID
  • search: returns a list of search results based on a plain text search
  • export: returns a list of decisions
  • stats: returns aggregated data
  • transaction_history: @TODO
  • scan: @TODO

03.1 - Client initialization

To instantiate JudilibreClient, you need to pass the URL of the API and the key of the API:

from pyjudilibre import JudilibreClient

client = JudilibreClient(
    judilibre_api_url=JUDILIBRE_API_URL,
    judilibre_api_url=JUDILIBRE_API_KEY,
)

03.2 - Healthcheck

The .healthcheck method queries the GET /healthcheck. This method will return True if the API is available or False if not.

healthcheck: bool = client.healthcheck()
print(healthchek)

03.3 - Decision

The main endpoint of the API, GET /decision is available through the .decision method. It returns a JudilibreDecision if a decision ID is provided:

DECISION_ID = "5fca9e9f7fceed9498daf2cf"

decision = client.decision(decision_id=DECISION_ID)
print(
    decision.jurisdiction,
    decision.date_decision,
)

03.4 - Stats

03.5 - Search

03.6 - Export

04 - Development

To work on the library, you can use a virtual environment and install all the extras:

git clone https://github.com/pauldechorgnat/pyJudilibre.git
cd pyJudilibre

python3 -m venv venv
pip install .[dev,test,build]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjudilibre-0.5.12.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyjudilibre-0.5.12-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file pyjudilibre-0.5.12.tar.gz.

File metadata

  • Download URL: pyjudilibre-0.5.12.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for pyjudilibre-0.5.12.tar.gz
Algorithm Hash digest
SHA256 2b3a40291d7a9312af3348ffb0a6dab962f2ec9d0121efe656c503667bca9e05
MD5 4ab30d667f6fc8848cd305e3dd206698
BLAKE2b-256 ebc7a8c59c69a042e8f9e8ad621ac0425a88bdf3767a8889485dda25d2961c2c

See more details on using hashes here.

File details

Details for the file pyjudilibre-0.5.12-py3-none-any.whl.

File metadata

  • Download URL: pyjudilibre-0.5.12-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for pyjudilibre-0.5.12-py3-none-any.whl
Algorithm Hash digest
SHA256 99a6a13803fb7234f39af4f970f89a43273b40079956c51bd4e7dfc64f9df37a
MD5 01b2fda8f4cd7850cd48ef28f1c12346
BLAKE2b-256 92b18456d19cdb1ec486bb7d82b85046067e3e4452cfee681cb98a08b8af9e29

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page