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

A modern, lightweight Python client SDK for retrieving and querying open parliament data from the national parliament of Ireland (Houses of the Oireachtas).

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 client
client = oireachtas_api.ConstituenciesApi()

try:
    # 2. Query constituencies (limiting to 5 results)
    response = client.constituencies(limit=5)
    
    # 3. Print the API response
    print("--- Oireachtas Constituencies ---")
    pprint(response)
except oireachtas_api.rest.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.

Service Class Method API Description / Use Case Official Specs
ConstituenciesApi constituencies() Retrieve electoral districts Docs
DebatesApi debates() Access official debates transcripts Docs
DivisionsApi divisions() Inspect parliamentary votes and counts Docs
HousesApi houses() Query house info (Dáil or Seanad) Docs
LegislationApi legislation() Query active & historic bills and acts Docs
MembersApi members() Look up details of TDs and Senators Docs
PartiesApi parties() List political parties Docs
QuestionsApi questions() Query parliamentary questions (PQs) Docs

🧪 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.0.1.tar.gz (50.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.0.1-py3-none-any.whl (240.2 kB view details)

Uploaded Python 3

File details

Details for the file oireachtas_api-2.0.1.tar.gz.

File metadata

  • Download URL: oireachtas_api-2.0.1.tar.gz
  • Upload date:
  • Size: 50.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.0.1.tar.gz
Algorithm Hash digest
SHA256 6dfe991d6cea97dcb8e5c2feb6dde3de6b08ed07e9a7539da1c81e347902c36f
MD5 c00ccd28a71db8b3baa009d77be1e4a8
BLAKE2b-256 8cbce1fecd23a04728f16de521c90c8a189c089c38b883a7fd132dffa28ed54f

See more details on using hashes here.

Provenance

The following attestation bundles were made for oireachtas_api-2.0.1.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.0.1-py3-none-any.whl.

File metadata

  • Download URL: oireachtas_api-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 240.2 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b991e7270e86c5dfa6854998b8c72929d950fc4ebdbec2851c3f6650c70990d
MD5 7fb44a189570410d3e1bf4cf890741fd
BLAKE2b-256 c3e456177b779df674b7db8652b7dd07a82b37f8c9ef18a74296644f9e011d05

See more details on using hashes here.

Provenance

The following attestation bundles were made for oireachtas_api-2.0.1-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