Skip to main content

LexMachina API python SDK

Project description

python-lexmachina-api-client

Python Client for Lex Machina Litigation Analytics API

This package provides a client to access the Lex Machina API for legal analytics. Access and documentation are provided at the Lex Machina API Developer Portal.

Getting Started

  1. Create a new venv with the command python3 -m venv /path/to/new/virtual/environment

  2. Run python3 -m pip install --upgrade pip setuptools wheel

  3. Install package with pip3 install lexmachina-client .

  4. Create an app and get the client key and secret via the directions here.

  5. In your project directory create a directory config and inside that create a file named config.ini . Populate using the below values and the key and secret from above. The below values for URLS should be used if you are using Lex Machina's production API. If you are testing this out with the sandbox API then you should use base_url = https://api.sandbox.lexmachina.com

    [URLS]
    token_url = /oauth2/token
    base_url = https://api.lexmachina.com
    
    [CREDENTIALS]
    client_id = "CLIENT_ID"
    client_secret ="CLIENT_SECRET"
    
  6. To execute API calls you will use the LexMachinaClient of this package. This is discussed in detail later.

    For each of these, you first create the object then call the functions on that object.

Lex Machina Client

The LexMachinaClient object is the main way to interact with the Lex Machina API.

Instantiating the LexMachinaClient object

If called with no parameter in the constructor, the config file will be loaded from the config directory created earlier.

from lexmachina import LexMachinaClient

client = LexMachinaClient()

If passed a string for a file path, the config file will be loaded from that location.

client = LexMachinaClient("../config/config.ini")

GET functions from LexMachinaClient

The functions provided fall into several classes:

  1. Lists of resources
  2. Lookup by ID
  3. Searches

Lists of Resources

These functions are available from LexMachinaClient. Each returns a JSON object describing resources.

  • LexMachinaClient.list_case_resolutions()
  • LexMachinaClient.list_case_tags()
  • LexMachinaClient.list_case_types()
  • LexMachinaClient.list_courts()
  • LexMachinaClient.list_damages()
  • LexMachinaClient.list_events()
  • LexMachinaClient.list_judgment_sources()

Lookup by ID(s)

These functions are available from LexMachinaClient. Each takes a single integer or an array of up to 100 integers where the parameter is the Lex Machina ID for that record. It will return a JSON object or an array of objects representing the data for that type of record.

  • LexMachinaClient.get_attorneys()
  • LexMachinaClient.get_district_cases()
  • LexMachinaClient.get_federal_judges()
  • LexMachinaClient.get_law_firms()
  • LexMachinaClient.get_magistrates()
  • LexMachinaClient.get_parties()
  • LexMachinaClient.get_patents()

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

lexmachina-client-1.0.3.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

lexmachina_client-1.0.3-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file lexmachina-client-1.0.3.tar.gz.

File metadata

  • Download URL: lexmachina-client-1.0.3.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lexmachina-client-1.0.3.tar.gz
Algorithm Hash digest
SHA256 aaf37f218f32adde21a408845837d3b98bb827d96ccef1ce9570bc9fa39d0012
MD5 fbc208568a4cd0f914a78c30a4eb1c9e
BLAKE2b-256 7b115fe1d395d6a172eb5df435dfe1ce32164546ba08271b048f7ce531e77bd0

See more details on using hashes here.

File details

Details for the file lexmachina_client-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lexmachina_client-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 46dae5fcf62f88a221df2d0b949a85c11a46ed9fa039f2d4eb5bcb76f669cc51
MD5 c0344b81a52c4b758f5e50acc8f4c8df
BLAKE2b-256 c5705e07f3fd6e3ef7345269647c327ab2b177c252200126359ba2d5591d64a7

See more details on using hashes here.

Supported by

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