Skip to main content

An API client for interacting with the Caselaw Marklogic instance

Project description

Caselaw Marklogic API Client

This is an API Client for connecting to Marklogic for The National Archive's Caselaw site.

This package is published on PyPI: https://pypi.org/project/ds-caselaw-marklogic-api-client/

Usage

Include the API client in your project using PIP:

pip install ds-caselaw-marklogic-api-client

or in your projects requirements.txt with:

ds-caselaw-marklogic-api-client~=2.0.0

Using the client

The client expects the following environment variables to be set or defined in a .env file:

MARKLOGIC_HOST
MARKLOGIC_USER
MARKLOGIC_PASSWORD
MARKLOGIC_USE_HTTPS # Optional, defaults to False

Then import api_client from caselawclient.Client:

from caselawclient.Client import api_client

Alternatively, you can import the base class and instantiate it with different credentials:

from caselawclient.Client import MarklogicApiClient

client = MarklogicApiClient(
    host="",
    username="",
    password="",
    use_https=False,
)

Client also exports some exception classes:

MarklogicAPIError
MarklogicBadRequestError
MarklogicUnauthorizedError
MarklogicNotPermittedError
MarklogicResourceNotFoundError
MarklogicCommunicationError

XML Tools

There is also a small set of xml helper tools that provide some common functionality for dealing with xml:

from caselawclient import xml_tools

xml_tools.get_metadata_name_value(xml)
xml_toosl.get_metadata_name_element(xml)
xml_tools.get_search_matches(element)

Making changes

When making a change, update the changelog using the Keep a Changelog 1.0.0 format. Pull requests should not be merged before any relevant updates are made.

Releasing changes

When making a new release, update the changelog in the release pull request.

The package will only be released to PyPI if the branch is tagged. A merge to main alone will not trigger a release to PyPI.

To create a release:

  1. Update the version number in setup.cfg
  2. Create a branch release/v{major}.{minor}.{patch}
  3. Update changelog for the release
  4. Commit and push
  5. Open a PR from that branch to main
  6. Get approval on the PR
  7. Tag the HEAD of the PR v{major}.{minor}.{patch} and push the tag
  8. Merge the PR to main and push

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

ds-caselaw-marklogic-api-client-2.1.0.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

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