Skip to main content

Houses of the Oireachtas Open Data APIs Python SDK

Project description

Houses of the Oireachtas Open Data API - Python SDK

Build Status Version Python Version Documentation

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 pytest with 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:

  1. Ensure your version code is up to date in setup.py.
  2. Commit your changes and tag the master branch:
    git tag v2.0.0
    git push origin v2.0.0
    
  3. 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

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

oireachtas_api-2.1.0.tar.gz (55.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oireachtas_api-2.1.0-py3-none-any.whl (245.0 kB view details)

Uploaded Python 3

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

Hashes for oireachtas_api-2.1.0.tar.gz
Algorithm Hash digest
SHA256 d7aa3eb05d36088a15887b592dbbdf6909dfa435ee7c8dbdde5677fdfd28d3af
MD5 676a6ad31cb22e578ac8039867cddcfa
BLAKE2b-256 3a9a87497df7dc9b8509dbca6a35e07a7443e177e5ed0e13fa81d0024d2d1831

See more details on using hashes here.

Provenance

The following attestation bundles were made for oireachtas_api-2.1.0.tar.gz:

Publisher: release.yml on Irishsmurf/OireachtasAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for oireachtas_api-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1af1c988f3eb20688a32e0871e139960cbaea72e0ce941ae9f291d46c9f23602
MD5 a51c2f4525069e5f5c155f084f42dd4b
BLAKE2b-256 a31acec1eb1d909126b4d75b23472d60179e20b1f531eaec46054b0e89e8ca51

See more details on using hashes here.

Provenance

The following attestation bundles were made for oireachtas_api-2.1.0-py3-none-any.whl:

Publisher: release.yml on Irishsmurf/OireachtasAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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