obrasgovpy
Access the open data API of ObrasGov.br, the Brazilian federal government's platform for public infrastructure projects, from Python.
This is the Python sibling of obrasgovr; the two cover the same ground with the same semantics.
What this package covers
The package targets the public API at
api-publica.obrasgov.gestao.gov.br/obras
(documentation),
which publishes eight resources:
| Function | Resource | Endpoint |
|---|---|---|
get_projects() |
Infrastructure projects, with executors, recipients, funding sources, policy areas and geometries nested | projeto-investimento |
get_commitments() |
Budget commitments and financial execution amounts | empenho |
get_physical_execution() |
Physical execution percentages, instruments and dates | execucao-fisica |
get_contracts() |
Contracts linked to projects | contrato |
get_geometries() |
Geometries and territorial identifiers | geometria |
get_status_history() |
Histories of cancelled or suspended projects | historico-situacao-cancelada-paralisada |
get_feasibility_studies() |
Feasibility studies linked to projects | estudo-viabilidade |
get_last_update() |
The timestamp of the API's last data update | data-atualizacao |
Installation
pip install obrasgovpy
Getting started
import obrasgovpy as og
og.list_resources()
og.list_filters("projects")
projects = og.get_projects(uf_principal="PE", situacao="Em execução", page_size=50)
contracts = og.get_contracts(id_projeto_investimento="134851.26-07")
og.get_last_update()
Results are pandas DataFrames. Date columns arrive typed as datetimes, and one-to-many relationships are preserved as columns of lists. The totals the API reported, and how many pages were fetched, travel with the result:
og.result_metadata(projects)
Filter names and categorical values are in Portuguese because they belong to
the API. An unknown filter name is an error rather than a request, so a typo
cannot return plausible, wrong data. list_filters() shows each resource's
filters, their types and, for the enumerated ones, the permitted values.
Pagination
Each request returns one page of at most 200 records. page is the first
page to retrieve and page_size the records per page; with all_pages=True,
successive pages are collected starting at page:
import math
everything = og.get_projects(
uf_principal="PE",
page_size=200,
all_pages=True,
page_limit=math.inf, # the default: every page
)
Multi-page collection is defensive by design: the page number each response
reports is checked against the page requested, the pagination totals are
validated before they are trusted, and totals that contradict the payload are
an error rather than a silently truncated result. Requests are throttled to
60 per minute and transient failures are retried with backoff; tune both with
og.configure().
The previous ObrasGov API
This package exclusively uses the current environment. The previous ObrasGov API is not supported: ObrasGov set 31 August 2026 as the deadline for migrating away from it, and that deadline has passed.
Releasing (maintainers)
Publishing uses PyPI
Trusted Publishing: the
publish.yaml workflow builds and uploads when a GitHub release is published.
Register the publisher on PyPI with repository owner StrategicProjects,
repository obrasgovpy, workflow publish.yaml and environment pypi.
License
MIT. See LICENSE.
Metadata
Release files for obrasgovpy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| obrasgovpy-0.1.0.tar.gz | 19.6 kB | With provenance | Details for obrasgovpy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| obrasgovpy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for obrasgovpy-0.1.0-py3-none-any.whl |
Total release size: 36.6 kB
Release files / obrasgovpy-0.1.0.tar.gz
| Download URL | obrasgovpy-0.1.0.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfaa473e4bddbf955128517b04e5104065e4912bba7c554ee0f2e0e713c586f6
|
|
BLAKE2b-256 checksum How to use checksums |
8d110d88d50e33acaa7bb4bb44d37d16bd11d1be050cdc810d69a946ed1bc4b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / obrasgovpy-0.1.0-py3-none-any.whl
| Download URL | obrasgovpy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46881a6d0be3073fd53fe08c29bfeafbcfed6612cb927c1a1f7c8b508f263357
|
|
BLAKE2b-256 checksum How to use checksums |
243a36cd3ce160af2518de46e8e659a3ff2006565d0a17540fdff33e3b199355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for obrasgovpy 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for obrasgovpy-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.