BDNS API
========
[](https://badge.fury.io/py/bdns-api)
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://www.python.org/downloads/)
A comprehensive command-line tool for accessing and processing data from the BDNS (Base de Datos Nacional de Subvenciones) API - the Spanish government's national subsidies database.
## ✨ Features
- **29 API Commands**: Complete coverage of all BDNS API endpoints
- **JSONL Output Format**: Clean JSON Lines format for easy data processing
- **Flexible Configuration**: Customizable parameters for each command
## 📋 Available Commands
This tool provides access to all **29 BDNS API endpoints**. Each command fetches specific data from the Spanish government's subsidies database.
For a complete list of all commands and their parameters, use:
```bash
bdns-api --help
```
For help on a specific command:
```bash
bdns-api [command-name] --help
# Example: bdns-api organos --help
```
**📖 API Documentation**: Complete endpoint documentation is available at [BDNS API Swagger](https://www.infosubvenciones.es/bdnstrans/doc/swagger)
## 🚀 Quick Start
### Installation
**From PyPI (recommended):**
```bash
pip install bdns-api
```
**From source:**
```bash
git clone https://github.com/cruzlorite/bdns-api.git
cd bdns-api
poetry install
```
### CLI Usage
**Getting Help:**
```bash
# List all available commands
bdns-api --help
# Get help for a specific command
bdns-api organos --help
bdns-api ayudasestado-busqueda --help
```
**Basic Examples:**
```bash
# Fetch government organs data to file
bdns-api organos --output-file government_organs.jsonl
# Get economic activities (to stdout by default)
bdns-api actividades
# Search state aids with filters
bdns-api ayudasestado-busqueda \
--descripcion "innovation" \
--num-pages 3 \
--pageSize 1000 \
--output-file innovation_aids.jsonl
# Get specific strategic plan by ID
bdns-api planesestrategicos --idPES 459 --output-file plan_459.jsonl
```
**Common Parameters:**
- `--output-file FILE`: Save output to file (defaults to stdout)
- `--vpd CODE`: Territory code (GE=Spain, specific regions available)
- `--num-pages N`: Number of pages to fetch (for paginated commands)
- `--pageSize N`: Records per page (default: 10000, max: 10000)
**Advanced Search Example:**
```bash
# Search concessions with multiple filters
bdns-api concesiones-busqueda \
--descripcion "research" \
--fechaDesde "2023-01-01" \
--fechaHasta "2024-12-31" \
--tipoAdministracion "C" \
--num-pages 10 \
--output-file research_concessions.jsonl
```
## 📖 More Examples
```bash
# Download all government organs
bdns-api organos --output-file government_structure.jsonl
# Search for innovation-related subsidies
bdns-api ayudasestado-busqueda --descripcion "innovation" --output-file innovation_aids.jsonl
# Get latest calls for proposals
bdns-api convocatorias-ultimas --output-file latest_calls.jsonl
# Search sanctions data
bdns-api sanciones-busqueda --output-file sanctions.jsonl
```
Output format (JSON Lines):
```json
{"id": 1, "descripcion": "MINISTERIO DE AGRICULTURA, PESCA Y ALIMENTACIÓN", "codigo": "E04"}
{"id": 2, "descripcion": "MINISTERIO DE ASUNTOS EXTERIORES, UNIÓN EUROPEA Y COOPERACIÓN", "codigo": "E05"}
```
## 🛠️ Development
### Prerequisites
- Python 3.11+
- Poetry for dependency management
### Development Setup
```bash
# Clone and setup
git clone https://github.com/cruzlorite/bdns-api.git
cd bdns-api
poetry install --with dev
# Available Make targets
make help # Show all available targets
make install # Install project dependencies
make dev-install # Install with development dependencies
make lint # Run code linting with ruff
make format # Format code with ruff formatter
make test-integration # Run integration tests
make clean # Remove build artifacts
make all # Install, lint, format, and test
```
## 🙏 Acknowledgments
This project is inspired by previous work from [Jaime Ortega Obregón](https://github.com/JaimeObregon/subvenciones/tree/main).
## 📜 License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "bdns-api",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "bdns, subsidies, spanish-government, api, data, cli",
"author": "Jos\u00e9 Mar\u00eda Cruz Lorite",
"author_email": "josemariacruzlorite@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f9/e9/83167649a8b7fd6ab511524ff847090689688f1ff1a18c5fc6c9aa4574c6/bdns_api-1.0.2.tar.gz",
"platform": null,
"description": "BDNS API\n========\n[](https://badge.fury.io/py/bdns-api)\n[](https://www.gnu.org/licenses/gpl-3.0)\n[](https://www.python.org/downloads/)\n\nA comprehensive command-line tool for accessing and processing data from the BDNS (Base de Datos Nacional de Subvenciones) API - the Spanish government's national subsidies database.\n\n## \u2728 Features\n\n- **29 API Commands**: Complete coverage of all BDNS API endpoints\n- **JSONL Output Format**: Clean JSON Lines format for easy data processing\n- **Flexible Configuration**: Customizable parameters for each command\n\n## \ud83d\udccb Available Commands\n\nThis tool provides access to all **29 BDNS API endpoints**. Each command fetches specific data from the Spanish government's subsidies database.\n\nFor a complete list of all commands and their parameters, use:\n```bash\nbdns-api --help\n```\n\nFor help on a specific command:\n```bash\nbdns-api [command-name] --help\n# Example: bdns-api organos --help\n```\n\n**\ud83d\udcd6 API Documentation**: Complete endpoint documentation is available at [BDNS API Swagger](https://www.infosubvenciones.es/bdnstrans/doc/swagger)\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n**From PyPI (recommended):**\n```bash\npip install bdns-api\n```\n\n**From source:**\n```bash\ngit clone https://github.com/cruzlorite/bdns-api.git\ncd bdns-api\npoetry install\n```\n\n### CLI Usage\n\n**Getting Help:**\n```bash\n# List all available commands\nbdns-api --help\n\n# Get help for a specific command \nbdns-api organos --help\nbdns-api ayudasestado-busqueda --help\n```\n\n**Basic Examples:**\n```bash\n# Fetch government organs data to file\nbdns-api organos --output-file government_organs.jsonl\n\n# Get economic activities (to stdout by default)\nbdns-api actividades\n\n# Search state aids with filters\nbdns-api ayudasestado-busqueda \\\n --descripcion \"innovation\" \\\n --num-pages 3 \\\n --pageSize 1000 \\\n --output-file innovation_aids.jsonl\n\n# Get specific strategic plan by ID\nbdns-api planesestrategicos --idPES 459 --output-file plan_459.jsonl\n```\n\n**Common Parameters:**\n- `--output-file FILE`: Save output to file (defaults to stdout)\n- `--vpd CODE`: Territory code (GE=Spain, specific regions available)\n- `--num-pages N`: Number of pages to fetch (for paginated commands)\n- `--pageSize N`: Records per page (default: 10000, max: 10000)\n\n**Advanced Search Example:**\n```bash\n# Search concessions with multiple filters\nbdns-api concesiones-busqueda \\\n --descripcion \"research\" \\\n --fechaDesde \"2023-01-01\" \\\n --fechaHasta \"2024-12-31\" \\\n --tipoAdministracion \"C\" \\\n --num-pages 10 \\\n --output-file research_concessions.jsonl\n```\n\n## \ud83d\udcd6 More Examples\n\n```bash\n# Download all government organs\nbdns-api organos --output-file government_structure.jsonl\n\n# Search for innovation-related subsidies\nbdns-api ayudasestado-busqueda --descripcion \"innovation\" --output-file innovation_aids.jsonl\n\n# Get latest calls for proposals\nbdns-api convocatorias-ultimas --output-file latest_calls.jsonl\n\n# Search sanctions data\nbdns-api sanciones-busqueda --output-file sanctions.jsonl\n```\n\nOutput format (JSON Lines):\n```json\n{\"id\": 1, \"descripcion\": \"MINISTERIO DE AGRICULTURA, PESCA Y ALIMENTACI\u00d3N\", \"codigo\": \"E04\"}\n{\"id\": 2, \"descripcion\": \"MINISTERIO DE ASUNTOS EXTERIORES, UNI\u00d3N EUROPEA Y COOPERACI\u00d3N\", \"codigo\": \"E05\"}\n```\n\n## \ud83d\udee0\ufe0f Development\n\n### Prerequisites\n- Python 3.11+\n- Poetry for dependency management\n\n### Development Setup\n```bash\n# Clone and setup\ngit clone https://github.com/cruzlorite/bdns-api.git\ncd bdns-api\npoetry install --with dev\n\n# Available Make targets\nmake help # Show all available targets\nmake install # Install project dependencies \nmake dev-install # Install with development dependencies\nmake lint # Run code linting with ruff\nmake format # Format code with ruff formatter\nmake test-integration # Run integration tests\nmake clean # Remove build artifacts\nmake all # Install, lint, format, and test\n```\n\n## \ud83d\ude4f Acknowledgments\n\nThis project is inspired by previous work from [Jaime Ortega Obreg\u00f3n](https://github.com/JaimeObregon/subvenciones/tree/main).\n\n## \ud83d\udcdc License\n\nThis project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the [LICENSE](LICENSE) file for details.\n\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "A comprehensive command-line tool for accessing Spanish government BDNS subsidies data",
"version": "1.0.2",
"project_urls": {
"Documentation": "https://github.com/cruzlorite/bdns-api#readme",
"Homepage": "https://github.com/cruzlorite/bdns-api",
"Repository": "https://github.com/cruzlorite/bdns-api"
},
"split_keywords": [
"bdns",
" subsidies",
" spanish-government",
" api",
" data",
" cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "251fdf310f993685b425f3614f74f9de19134e715c037de3c78787eee43c5cd7",
"md5": "5384d38947ba51647595221952e3d86d",
"sha256": "9f2c27891bbb2e5f8f02c48fbfe54b76a4a013035543e0cfbb636570be562a27"
},
"downloads": -1,
"filename": "bdns_api-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5384d38947ba51647595221952e3d86d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 56062,
"upload_time": "2025-08-18T18:12:30",
"upload_time_iso_8601": "2025-08-18T18:12:30.090000Z",
"url": "https://files.pythonhosted.org/packages/25/1f/df310f993685b425f3614f74f9de19134e715c037de3c78787eee43c5cd7/bdns_api-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f9e983167649a8b7fd6ab511524ff847090689688f1ff1a18c5fc6c9aa4574c6",
"md5": "7957f494fde134874591845a1185106f",
"sha256": "f240c2b71bf44e4a91af24168a2a5271e34e07979ae967c6275afdb6a2e705fc"
},
"downloads": -1,
"filename": "bdns_api-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "7957f494fde134874591845a1185106f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 27888,
"upload_time": "2025-08-18T18:12:31",
"upload_time_iso_8601": "2025-08-18T18:12:31.726802Z",
"url": "https://files.pythonhosted.org/packages/f9/e9/83167649a8b7fd6ab511524ff847090689688f1ff1a18c5fc6c9aa4574c6/bdns_api-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-18 18:12:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cruzlorite",
"github_project": "bdns-api#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bdns-api"
}