A Python client for interacting with our Blaise REST API. It provides a convenient wrapper for making requests to Blaise from Python applications. This repository provides the client library; it does not run or deploy the REST API.
blaise_restapi/client.pycontains the REST API client.blaise_restapi/functions/contains questionnaire helpers.tests/contains tests using mocked HTTP responses.
-
Add the package to your project using Poetry, using a published GitHub release tag for stability:
poetry add git+https://github.com/ONSdigital/blaise-api-python-client.git@v1.0.3
-
Import the client and create an instance by passing in the REST API URL:
import blaise_restapi restapi_client = blaise_restapi.Client("http://restapi-url") # Example usage case = restapi_client.get_case("server_park", "questionnaire_name", "case_id")
- Install Python 3.13 and Poetry.
- Run
poetry installto install the project and development dependencies.
- Run
make lintto check linting and formatting. - Run
make lint-fixto apply auto-fixes and formatting.
- Run
make typecheckto run Pyright in strict mode.
- Run
make deptryto check dependencies. - Run
make vultureto check for unused code.
- Run
make testto run tests and report coverage.