An API client for interacting with the Caselaw Marklogic instance
Project description
The National Archives: Find Case Law
This repository is part of the Find Case Law project at The National Archives. For more information on the project, check the documentation.
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_tools.get_metadata_name_element(xml)
xml_tools.get_search_matches(element)
Testing
To run the test suite:
pip install -r requirements.txt
python -m pytest
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
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:
- Update the version number in
setup.cfg - Create a branch
release/v{major}.{minor}.{patch} - Update
CHANGELOG.mdfor the release - Commit and push
- Open a PR from that branch to main
- Get approval on the PR
- Merge the PR to main and push
- Tag the merge commit on
mainwithv{major}.{minor}.{patch}and push the tag - Create a release in Github releases using the created tag
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ds-caselaw-marklogic-api-client-5.2.3.tar.gz.
File metadata
- Download URL: ds-caselaw-marklogic-api-client-5.2.3.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c57ef06cb36338cebbae913e2d875c8de7dc977604fb4d45c69c7b9e90bc1524
|
|
| MD5 |
a32ed2814cafc3b43363c7e48e8283dd
|
|
| BLAKE2b-256 |
a938910123496a387ed607c2c5f3b0d98f517dacce8cfc531b3f159e62900315
|
File details
Details for the file ds_caselaw_marklogic_api_client-5.2.3-py3-none-any.whl.
File metadata
- Download URL: ds_caselaw_marklogic_api_client-5.2.3-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daca3f8665886cbea33605a6a233953efcc3030a741e612d87e8ed95f1ca09ae
|
|
| MD5 |
18c2b82cb1028cc6bcec5fcf5a1a5cf2
|
|
| BLAKE2b-256 |
c5712e5d48a401b96c44b3824074f720690b8653230c51aa9006459bc06d4376
|