Skip to main content

Official Python client for the Brubru EU Data API: the whole EU institutional data estate behind one key.

Project description

brubru

The official Python client for the Brubru EU Data API: the whole EU institutional data estate behind one key. Legislation, procedures, institutions, the social directory and the input-first extract engine, all on the same five-datapoint contract.

Install

pip install brubru

Only dependency: requests.

Quickstart

import brubru

bru = brubru.Client(api_key="brubru_live_...")

# Extract structured items from any EU institutional URL (optionally EuroVoc-tagged)
res = bru.extract("https://cinea.ec.europa.eu/news-events/news_en", classify=True)
for item in res:
    print(item.document_date, item.title, item.public_url)

# The social directory: recent posts from a mapped entity
page = bru.social.posts(entity_type="commissioner", platform="x", limit=20)
for post in page:
    print(post.entity_name, post.public_url)

# Stream across all pages, capped
for post in bru.social.iter_posts(entity_type="mep", max_items=200):
    ...

Authentication

Your key is sent as the X-API-Key header. Get one on the Professional subscription (hello@beresol.eu).

Base URL

The client defaults to the API host (brubru-production.up.railway.app). The brand domain brubru.beresol.eu serves the website and the static docs, not the API, so do not point the client there. Override base_url= once a dedicated API domain is in place.

Errors

Every non-2xx response raises a typed exception, all subclasses of brubru.BrubruError:

Status Exception
401 AuthError
402 PaymentRequiredError
403 ScopeError
404 NotFoundError
422 ValidationError
429 RateLimitError
5xx ServerError

Each carries .status and .payload.

The five datapoints

Every list/detail item exposes public_url, body_txt, body_html, document_date, creation_date (plus title/summary). On list calls body_txt/body_html are None; fetch the detail (bru.social.post(id)) for the full body. The original JSON is always on item.raw.

EuroVoc

To turn the eurovoc_descriptors an extract item carries into typed, domain-enriched objects, use the companion eurovoc package: eurovoc.from_descriptors(item.eurovoc_descriptors).

Tests

pip install -e '.[test]'
pytest -m "not live"                         # offline, no network
BRUBRU_API_KEY=brubru_live_... pytest -m live  # hits production read-only

MIT licensed. Built by Beresol BV.

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

brubru-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

brubru-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file brubru-0.1.0.tar.gz.

File metadata

  • Download URL: brubru-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brubru-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3878bed8366f2d4253558a3cfa4839d95517161cc3159a85a0cf92de82f4903d
MD5 ea86d484e99dc5f858e4eafe25fab725
BLAKE2b-256 733164dda6802ffd0e5d34cadf6bc135028f9fc7ff88673cfc32fa0f2414095d

See more details on using hashes here.

Provenance

The following attestation bundles were made for brubru-0.1.0.tar.gz:

Publisher: publish.yml on Beresol-BV/brubru-EU-scraper-library

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

File details

Details for the file brubru-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: brubru-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brubru-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6c622861d77031a541b4817500ff6a6c71aaf363edeca9c078fa1cd5034d3e3
MD5 9d0960d015e2f330b216b8d95cf92673
BLAKE2b-256 0b2c8b29ab9064bf318704b1ecc593fb8f2db0c965957f4b86ee6a652f450bf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for brubru-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Beresol-BV/brubru-EU-scraper-library

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