Houses of the Oireachtas Open Data APIs Python SDK
Project description
Houses of the Oireachtas Open Data API - Python SDK
A modern, lightweight Python client SDK for retrieving and querying open parliament data from the national parliament of Ireland (Houses of the Oireachtas).
📖 Full Documentation: The comprehensive interactive documentation built with MkDocs is available on GitHub Pages: https://irishsmurf.github.io/OireachtasAPI/
This client SDK makes metadata queries easy, allowing you to discover and locate specific official documents, bills, members, votes (divisions), and debates. Output formats point directly to XML/PDF datasets hosted at data.oireachtas.ie.
🚀 Key Features
- Modern Python 3 Support: Fully compatible with Python 3.8+ (legacy Python 2 support has been dropped).
- Fully Tested: Upgraded to use
pytestwith a complete suite of unit (mocked) and integration (live API) tests. - Open Access: Works out of the box with the public Oireachtas API endpoints (no authentication tokens required).
- Automated CI/CD: GitHub Actions verify compatibility on every push and automatically build & publish new GitHub Releases when tags are created.
🛠 Installation
Installing via PyPI
You can install the package directly from PyPI:
pip install oireachtas-api
Installing directly from GitHub
To install the latest development version directly from GitHub:
pip install git+https://github.com/Irishsmurf/OireachtasAPI.git
Local Development Setup
To clone the repository and install it in editable mode with development dependencies:
# Clone the repository
git clone https://github.com/Irishsmurf/OireachtasAPI.git
cd OireachtasAPI
# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install requirements
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt -r test-requirements.txt
pip install -e .
💡 Quick Start Example
This code demonstrates how to retrieve the 5 most recent active Constituencies:
import oireachtas_api
from pprint import pprint
# 1. Initialize the simplified client
client = oireachtas_api.Client()
try:
# 2. Query constituencies (returns standard Python list/dict)
response = client.constituencies(limit=5)
# 3. Print the API response
print("--- Oireachtas Constituencies ---")
pprint(response)
except oireachtas_api.ApiException as e:
print(f"Failed to query constituencies: {e}")
📂 Core API Reference
All requests call the live API endpoint: https://api.oireachtas.ie/v1.
Simplified Unified Client
The Client class consolidates all endpoints into a single wrapper. Method calls return standard Python dictionaries and lists, eliminating the need to interact with verbose auto-generated model objects:
import oireachtas_api
client = oireachtas_api.Client()
# Retrieve constituencies
constituencies = client.constituencies(limit=5)
# Access member information
members = client.members(limit=10)
| Method API | Description / Use Case | Official Specs |
|---|---|---|
constituencies() |
Retrieve electoral districts | Docs |
debates() |
Access official debates transcripts | Docs |
divisions() |
Inspect parliamentary votes and counts | Docs |
houses() |
Query house info (Dáil or Seanad) | Docs |
legislation() |
Query active & historic bills and acts | Docs |
members() |
Look up details of TDs and Senators | Docs |
parties() |
List political parties | Docs |
questions() |
Query parliamentary questions (PQs) | Docs |
Note: The legacy individual service API classes (ConstituenciesApi, MembersApi, etc.) and data models are still exported for backward compatibility.
🧪 Testing Guide
We use pytest for unit and integration tests.
1. Isolated Unit Tests (Mocked Network)
To run local test stubs using mock API responses (extremely fast, offline-safe):
pytest -m "not integration"
2. Live Integration Tests
To verify compatibility against the real, live Oireachtas API endpoints:
pytest -m "integration"
3. Run the Whole Test Suite
To run all tests:
pytest
🏷 Release Automation
This project tracks official releases automatically:
- Ensure your version code is up to date in setup.py.
- Commit your changes and tag the master branch:
git tag v2.0.0 git push origin v2.0.0
- The Release Workflow will automatically build the package wheels, publish a GitHub Release with build assets attached, and publish the release to PyPI using OIDC Trusted Publishing.
📬 Contact & Support
- Official API Portal: beta.oireachtas.ie/en/open-data
- Email: open.data@oireachtas.ie
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 oireachtas_api-2.1.0.tar.gz.
File metadata
- Download URL: oireachtas_api-2.1.0.tar.gz
- Upload date:
- Size: 55.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7aa3eb05d36088a15887b592dbbdf6909dfa435ee7c8dbdde5677fdfd28d3af
|
|
| MD5 |
676a6ad31cb22e578ac8039867cddcfa
|
|
| BLAKE2b-256 |
3a9a87497df7dc9b8509dbca6a35e07a7443e177e5ed0e13fa81d0024d2d1831
|
Provenance
The following attestation bundles were made for oireachtas_api-2.1.0.tar.gz:
Publisher:
release.yml on Irishsmurf/OireachtasAPI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oireachtas_api-2.1.0.tar.gz -
Subject digest:
d7aa3eb05d36088a15887b592dbbdf6909dfa435ee7c8dbdde5677fdfd28d3af - Sigstore transparency entry: 1885441067
- Sigstore integration time:
-
Permalink:
Irishsmurf/OireachtasAPI@8b26c4e0857ad1b6142364cc1300fc3c9091cb51 -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/Irishsmurf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8b26c4e0857ad1b6142364cc1300fc3c9091cb51 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oireachtas_api-2.1.0-py3-none-any.whl.
File metadata
- Download URL: oireachtas_api-2.1.0-py3-none-any.whl
- Upload date:
- Size: 245.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1af1c988f3eb20688a32e0871e139960cbaea72e0ce941ae9f291d46c9f23602
|
|
| MD5 |
a51c2f4525069e5f5c155f084f42dd4b
|
|
| BLAKE2b-256 |
a31acec1eb1d909126b4d75b23472d60179e20b1f531eaec46054b0e89e8ca51
|
Provenance
The following attestation bundles were made for oireachtas_api-2.1.0-py3-none-any.whl:
Publisher:
release.yml on Irishsmurf/OireachtasAPI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oireachtas_api-2.1.0-py3-none-any.whl -
Subject digest:
1af1c988f3eb20688a32e0871e139960cbaea72e0ce941ae9f291d46c9f23602 - Sigstore transparency entry: 1885441091
- Sigstore integration time:
-
Permalink:
Irishsmurf/OireachtasAPI@8b26c4e0857ad1b6142364cc1300fc3c9091cb51 -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/Irishsmurf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8b26c4e0857ad1b6142364cc1300fc3c9091cb51 -
Trigger Event:
push
-
Statement type: