infobus


Nameinfobus JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA Python client library and CLI tools for accessing Infobús external APIs and integrating transit data into research workflows
upload_time2025-08-22 14:49:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseApache-2.0
keywords api-client gtfs public-transportation research transit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Infobús Python Client

[![PyPI version](https://badge.fury.io/py/infobus.svg)](https://badge.fury.io/py/infobus)
[![Python Support](https://img.shields.io/pypi/pyversions/infobus.svg)](https://pypi.org/project/infobus/)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

A Python client library and CLI tools for accessing Infobús external APIs and integrating transit data into research workflows.

## Overview

The `infobus` package provides a simple and efficient way to interact with Infobús APIs, enabling researchers and developers to:

- Access real-time transit data from public transportation systems
- Retrieve historical transit information for analysis
- Integrate GTFS Realtime feeds into research workflows
- Query screen and display information
- Access weather and alert data associated with transit stops

## Installation

```bash
# Install from PyPI (when available)
pip install infobus

# Install from source
pip install git+https://github.com/simovilab/infobus-py.git

# Development installation
git clone https://github.com/simovilab/infobus-py.git
cd infobus-py
pip install -e ".[dev]"
```

## Quick Start

### Python Library

```python
from infobus import InfobusClient

# Initialize client
client = InfobusClient(base_url="https://your-infobus-instance.com")

# Get real-time transit data
transit_data = client.get_realtime_data()

# Query specific routes
route_info = client.get_route(route_id="route_123")

# Get screen information
screens = client.get_screens()
```

### Command Line Interface

```bash
# Get help
infobus --help

# List available routes
infobus routes list

# Get real-time data for a specific route
infobus realtime --route-id route_123

# Export data to CSV
infobus export --format csv --output data.csv
```

## Features

### Core API Client
- **RESTful API Integration**: Clean interface to Infobús REST endpoints
- **Authentication Support**: Token-based authentication handling
- **Error Handling**: Comprehensive error handling with meaningful messages
- **Rate Limiting**: Built-in rate limiting and retry logic

### Data Models
- **Pydantic Models**: Type-safe data models for all API responses
- **GTFS Compatibility**: Models aligned with GTFS and GTFS Realtime specifications
- **Validation**: Automatic data validation and serialization

### CLI Tools
- **Interactive Commands**: Easy-to-use command-line interface
- **Data Export**: Export data in multiple formats (JSON, CSV, XML)
- **Batch Operations**: Process multiple requests efficiently
- **Configuration Management**: Store and manage API credentials

### Research Integration
- **Pandas Integration**: Easy conversion to pandas DataFrames
- **Time Series Support**: Built-in support for time-based analysis
- **Geospatial Data**: Integration with geospatial libraries

## Configuration

Create a configuration file at `~/.infobus/config.yaml`:

```yaml
api:
  base_url: "https://your-infobus-instance.com"
  token: "your-api-token"
  timeout: 30

logging:
  level: "INFO"
  format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
```

## Development

### Setup Development Environment

```bash
# Clone repository
git clone https://github.com/simovilab/infobus-py.git
cd infobus-py

# Install development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install
```

### Running Tests

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=infobus

# Run specific test file
pytest tests/test_client.py
```

### Code Quality

```bash
# Format code
black src/ tests/
isort src/ tests/

# Type checking
mypy src/

# Run pre-commit checks
pre-commit run --all-files
```

## API Reference

### InfobusClient

The main client class for interacting with Infobús APIs.

```python
class InfobusClient:
    def __init__(self, base_url: str, token: str = None, timeout: int = 30)
    def get_realtime_data(self, **filters) -> List[RealtimeData]
    def get_routes(self) -> List[Route]
    def get_route(self, route_id: str) -> Route
    def get_screens(self) -> List[Screen]
    def get_alerts(self) -> List[Alert]
```

### Data Models

- `RealtimeData`: Real-time transit information
- `Route`: Transit route information
- `Screen`: Display screen information
- `Alert`: Service alerts and notifications
- `Weather`: Weather data for transit locations

## Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## Support

- **Documentation**: [GitHub README](https://github.com/simovilab/infobus-py#readme)
- **Issues**: [GitHub Issues](https://github.com/simovilab/infobus-py/issues)
- **Discussions**: [GitHub Discussions](https://github.com/simovilab/infobus-py/discussions)

## Related Projects

- [Infobús Server](https://github.com/fabianabarca/infobus) - The main Infobús Django application
- [django-app-gtfs](https://github.com/fabianabarca/django-app-gtfs) - GTFS data models for Django

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "infobus",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "api-client, gtfs, public-transportation, research, transit",
    "author": null,
    "author_email": "Fabi\u00e1n Abarca <ensinergia@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bf/d9/1b5c02d4ccf6ff90a96ba53c8e6472acccfdea6a126cc7c8bff7f58544aa/infobus-0.1.0.tar.gz",
    "platform": null,
    "description": "# Infob\u00fas Python Client\n\n[![PyPI version](https://badge.fury.io/py/infobus.svg)](https://badge.fury.io/py/infobus)\n[![Python Support](https://img.shields.io/pypi/pyversions/infobus.svg)](https://pypi.org/project/infobus/)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nA Python client library and CLI tools for accessing Infob\u00fas external APIs and integrating transit data into research workflows.\n\n## Overview\n\nThe `infobus` package provides a simple and efficient way to interact with Infob\u00fas APIs, enabling researchers and developers to:\n\n- Access real-time transit data from public transportation systems\n- Retrieve historical transit information for analysis\n- Integrate GTFS Realtime feeds into research workflows\n- Query screen and display information\n- Access weather and alert data associated with transit stops\n\n## Installation\n\n```bash\n# Install from PyPI (when available)\npip install infobus\n\n# Install from source\npip install git+https://github.com/simovilab/infobus-py.git\n\n# Development installation\ngit clone https://github.com/simovilab/infobus-py.git\ncd infobus-py\npip install -e \".[dev]\"\n```\n\n## Quick Start\n\n### Python Library\n\n```python\nfrom infobus import InfobusClient\n\n# Initialize client\nclient = InfobusClient(base_url=\"https://your-infobus-instance.com\")\n\n# Get real-time transit data\ntransit_data = client.get_realtime_data()\n\n# Query specific routes\nroute_info = client.get_route(route_id=\"route_123\")\n\n# Get screen information\nscreens = client.get_screens()\n```\n\n### Command Line Interface\n\n```bash\n# Get help\ninfobus --help\n\n# List available routes\ninfobus routes list\n\n# Get real-time data for a specific route\ninfobus realtime --route-id route_123\n\n# Export data to CSV\ninfobus export --format csv --output data.csv\n```\n\n## Features\n\n### Core API Client\n- **RESTful API Integration**: Clean interface to Infob\u00fas REST endpoints\n- **Authentication Support**: Token-based authentication handling\n- **Error Handling**: Comprehensive error handling with meaningful messages\n- **Rate Limiting**: Built-in rate limiting and retry logic\n\n### Data Models\n- **Pydantic Models**: Type-safe data models for all API responses\n- **GTFS Compatibility**: Models aligned with GTFS and GTFS Realtime specifications\n- **Validation**: Automatic data validation and serialization\n\n### CLI Tools\n- **Interactive Commands**: Easy-to-use command-line interface\n- **Data Export**: Export data in multiple formats (JSON, CSV, XML)\n- **Batch Operations**: Process multiple requests efficiently\n- **Configuration Management**: Store and manage API credentials\n\n### Research Integration\n- **Pandas Integration**: Easy conversion to pandas DataFrames\n- **Time Series Support**: Built-in support for time-based analysis\n- **Geospatial Data**: Integration with geospatial libraries\n\n## Configuration\n\nCreate a configuration file at `~/.infobus/config.yaml`:\n\n```yaml\napi:\n  base_url: \"https://your-infobus-instance.com\"\n  token: \"your-api-token\"\n  timeout: 30\n\nlogging:\n  level: \"INFO\"\n  format: \"%(asctime)s - %(name)s - %(levelname)s - %(message)s\"\n```\n\n## Development\n\n### Setup Development Environment\n\n```bash\n# Clone repository\ngit clone https://github.com/simovilab/infobus-py.git\ncd infobus-py\n\n# Install development dependencies\npip install -e \".[dev]\"\n\n# Install pre-commit hooks\npre-commit install\n```\n\n### Running Tests\n\n```bash\n# Run all tests\npytest\n\n# Run with coverage\npytest --cov=infobus\n\n# Run specific test file\npytest tests/test_client.py\n```\n\n### Code Quality\n\n```bash\n# Format code\nblack src/ tests/\nisort src/ tests/\n\n# Type checking\nmypy src/\n\n# Run pre-commit checks\npre-commit run --all-files\n```\n\n## API Reference\n\n### InfobusClient\n\nThe main client class for interacting with Infob\u00fas APIs.\n\n```python\nclass InfobusClient:\n    def __init__(self, base_url: str, token: str = None, timeout: int = 30)\n    def get_realtime_data(self, **filters) -> List[RealtimeData]\n    def get_routes(self) -> List[Route]\n    def get_route(self, route_id: str) -> Route\n    def get_screens(self) -> List[Screen]\n    def get_alerts(self) -> List[Alert]\n```\n\n### Data Models\n\n- `RealtimeData`: Real-time transit information\n- `Route`: Transit route information\n- `Screen`: Display screen information\n- `Alert`: Service alerts and notifications\n- `Weather`: Weather data for transit locations\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- **Documentation**: [GitHub README](https://github.com/simovilab/infobus-py#readme)\n- **Issues**: [GitHub Issues](https://github.com/simovilab/infobus-py/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/simovilab/infobus-py/discussions)\n\n## Related Projects\n\n- [Infob\u00fas Server](https://github.com/fabianabarca/infobus) - The main Infob\u00fas Django application\n- [django-app-gtfs](https://github.com/fabianabarca/django-app-gtfs) - GTFS data models for Django\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Python client library and CLI tools for accessing Infob\u00fas external APIs and integrating transit data into research workflows",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/simovilab/infobus-py/issues",
        "Documentation": "https://github.com/simovilab/infobus-py#readme",
        "Homepage": "https://github.com/simovilab/infobus-py",
        "Repository": "https://github.com/simovilab/infobus-py"
    },
    "split_keywords": [
        "api-client",
        " gtfs",
        " public-transportation",
        " research",
        " transit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5b142e05435c1f7653f8989825310bb198ebdb7139b7ec5e5f39dcf9d7465def",
                "md5": "c4fdf10b10a4b6203378f2eb9a22d649",
                "sha256": "0b2e0ba92386b1c54a2d48ab0648dcadfd7a24e0fe7b5ae5db9830fda26c899e"
            },
            "downloads": -1,
            "filename": "infobus-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c4fdf10b10a4b6203378f2eb9a22d649",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16243,
            "upload_time": "2025-08-22T14:49:13",
            "upload_time_iso_8601": "2025-08-22T14:49:13.932512Z",
            "url": "https://files.pythonhosted.org/packages/5b/14/2e05435c1f7653f8989825310bb198ebdb7139b7ec5e5f39dcf9d7465def/infobus-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bfd91b5c02d4ccf6ff90a96ba53c8e6472acccfdea6a126cc7c8bff7f58544aa",
                "md5": "2da868e08ff3e606d2991ea6460baac1",
                "sha256": "9fbd5ddd4413d37b19748c2c22c12dc50b586191ed0bf83c1ed7ec6085e9096b"
            },
            "downloads": -1,
            "filename": "infobus-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2da868e08ff3e606d2991ea6460baac1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 16191,
            "upload_time": "2025-08-22T14:49:15",
            "upload_time_iso_8601": "2025-08-22T14:49:15.388608Z",
            "url": "https://files.pythonhosted.org/packages/bf/d9/1b5c02d4ccf6ff90a96ba53c8e6472acccfdea6a126cc7c8bff7f58544aa/infobus-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-22 14:49:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simovilab",
    "github_project": "infobus-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "infobus"
}
        
Elapsed time: 1.24184s