rr-webapi


Namerr-webapi JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryPython client library for RaceResult Web API
upload_time2025-08-19 12:15:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords raceresult api timing sports events python
VCS
bugtrack_url
requirements requests python-dateutil python-dotenv
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RaceResult Python Web API Library

A Python client library for the RaceResult Web API that mirrors the functionality of the Go library.

## Features

- Pythonic API design with dataclasses
- Session management with automatic cleanup
- Event and participant operations
- Raw timing data retrieval
- Easy-to-use endpoint classes
- Type hints for better IDE support

## Installation

```bash
pip install -e .
# or for development:
pip install -r requirements.txt
```

## Quick Start

### Environment Setup

Create a `.env` file with your credentials:
```bash
RACERESULT_API_KEY=your_api_key_here
RACERESULT_USERNAME=your_username
RACERESULT_PASSWORD=your_password
```

### Basic Usage

```python
from rr_webapi import API
import os

# Create API client
api = API("events.raceresult.com", use_https=True)

# Login with API key
api.public().login(api_key=os.getenv("RACERESULT_API_KEY"))

try:
    # Get your events
    events = api.public().event_list()
    print(f"You have {len(events)} events")
    
    # Open an event
    if events:
        event_api = api.event_api(events[0].id)
        
        # Get participants
        participants = event_api.data.list([
            "ID", "BIB", "FIRSTNAME", "LASTNAME", "CONTEST.NAME"
        ])
        print(f"Event has {len(participants)} participants")
        
        # Get raw data for a participant
        if participants:
            raw_data = event_api.rawdata.get_by_pid(participants[0][0])  # ID is first field
            print(f"Participant has {len(raw_data)} raw data entries")

finally:
    # Always logout
    api.public().logout()
```

## API Structure

### Main Components

- **API**: Main client with session management
- **Public**: Authentication and account operations  
- **EventAPI**: Event-specific operations

### Event API Endpoints

- **data**: Participant data retrieval and filtering
- **participants**: Participant management (CRUD)
- **contests**: Contest/category management
- **rawdata**: Raw timing data access

## Authentication

### API Key Authentication
```python
api.public().login(api_key="your_api_key")
```

### Username/Password Authentication  
```python
api.public().login(username="username", password="password")
```

## Data Models

The library uses dataclasses for structured data:

```python
@dataclass
class EventListItem:
    id: str
    name: str
    date: str
    participants: int
    # ... other fields
```

## Examples

See the `../../examples/python/` directory for complete examples:
- `basic_usage.py`: Authentication and basic operations
- `participant_and_rawdata.py`: Advanced participant and timing data operations

## Development

```bash
# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run tests
python -m pytest tests/
```

## Requirements

- Python 3.7+
- requests
- python-dateutil
- python-dotenv

## Package Structure

```
rr_webapi/
├── __init__.py          # Main API class
├── api.py              # Core HTTP client
├── public.py           # Public API endpoints
├── eventapi.py         # Event API wrapper
├── general.py          # General utilities
└── endpoints/          # Endpoint implementations
    ├── data.py
    ├── contests.py
    ├── participants.py
    └── rawdata.py
```

## License

This library follows the same license as the original Go library.

## Contributing

1. Follow the existing code patterns
2. Add tests for new functionality
3. Update documentation
4. Ensure examples work with changes 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rr-webapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "SP Timing Team <dev@sptiming.ch>",
    "keywords": "raceresult, api, timing, sports, events, python",
    "author": null,
    "author_email": "SP Timing Team <dev@sptiming.ch>",
    "download_url": "https://files.pythonhosted.org/packages/54/b4/060cac5deb204861cf319588cc0d83902d17b3d16aa6a6c087409793f956/rr_webapi-0.1.7.tar.gz",
    "platform": null,
    "description": "# RaceResult Python Web API Library\n\nA Python client library for the RaceResult Web API that mirrors the functionality of the Go library.\n\n## Features\n\n- Pythonic API design with dataclasses\n- Session management with automatic cleanup\n- Event and participant operations\n- Raw timing data retrieval\n- Easy-to-use endpoint classes\n- Type hints for better IDE support\n\n## Installation\n\n```bash\npip install -e .\n# or for development:\npip install -r requirements.txt\n```\n\n## Quick Start\n\n### Environment Setup\n\nCreate a `.env` file with your credentials:\n```bash\nRACERESULT_API_KEY=your_api_key_here\nRACERESULT_USERNAME=your_username\nRACERESULT_PASSWORD=your_password\n```\n\n### Basic Usage\n\n```python\nfrom rr_webapi import API\nimport os\n\n# Create API client\napi = API(\"events.raceresult.com\", use_https=True)\n\n# Login with API key\napi.public().login(api_key=os.getenv(\"RACERESULT_API_KEY\"))\n\ntry:\n    # Get your events\n    events = api.public().event_list()\n    print(f\"You have {len(events)} events\")\n    \n    # Open an event\n    if events:\n        event_api = api.event_api(events[0].id)\n        \n        # Get participants\n        participants = event_api.data.list([\n            \"ID\", \"BIB\", \"FIRSTNAME\", \"LASTNAME\", \"CONTEST.NAME\"\n        ])\n        print(f\"Event has {len(participants)} participants\")\n        \n        # Get raw data for a participant\n        if participants:\n            raw_data = event_api.rawdata.get_by_pid(participants[0][0])  # ID is first field\n            print(f\"Participant has {len(raw_data)} raw data entries\")\n\nfinally:\n    # Always logout\n    api.public().logout()\n```\n\n## API Structure\n\n### Main Components\n\n- **API**: Main client with session management\n- **Public**: Authentication and account operations  \n- **EventAPI**: Event-specific operations\n\n### Event API Endpoints\n\n- **data**: Participant data retrieval and filtering\n- **participants**: Participant management (CRUD)\n- **contests**: Contest/category management\n- **rawdata**: Raw timing data access\n\n## Authentication\n\n### API Key Authentication\n```python\napi.public().login(api_key=\"your_api_key\")\n```\n\n### Username/Password Authentication  \n```python\napi.public().login(username=\"username\", password=\"password\")\n```\n\n## Data Models\n\nThe library uses dataclasses for structured data:\n\n```python\n@dataclass\nclass EventListItem:\n    id: str\n    name: str\n    date: str\n    participants: int\n    # ... other fields\n```\n\n## Examples\n\nSee the `../../examples/python/` directory for complete examples:\n- `basic_usage.py`: Authentication and basic operations\n- `participant_and_rawdata.py`: Advanced participant and timing data operations\n\n## Development\n\n```bash\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Run tests\npython -m pytest tests/\n```\n\n## Requirements\n\n- Python 3.7+\n- requests\n- python-dateutil\n- python-dotenv\n\n## Package Structure\n\n```\nrr_webapi/\n\u251c\u2500\u2500 __init__.py          # Main API class\n\u251c\u2500\u2500 api.py              # Core HTTP client\n\u251c\u2500\u2500 public.py           # Public API endpoints\n\u251c\u2500\u2500 eventapi.py         # Event API wrapper\n\u251c\u2500\u2500 general.py          # General utilities\n\u2514\u2500\u2500 endpoints/          # Endpoint implementations\n    \u251c\u2500\u2500 data.py\n    \u251c\u2500\u2500 contests.py\n    \u251c\u2500\u2500 participants.py\n    \u2514\u2500\u2500 rawdata.py\n```\n\n## License\n\nThis library follows the same license as the original Go library.\n\n## Contributing\n\n1. Follow the existing code patterns\n2. Add tests for new functionality\n3. Update documentation\n4. Ensure examples work with changes \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python client library for RaceResult Web API",
    "version": "0.1.7",
    "project_urls": {
        "Bug Reports": "https://github.com/SPTiming/python-rr-webapi/issues",
        "Documentation": "https://github.com/SPTiming/python-rr-webapi#readme",
        "Homepage": "https://github.com/SPTiming/python-rr-webapi",
        "Repository": "https://github.com/SPTiming/python-rr-webapi.git",
        "Source Code": "https://github.com/SPTiming/python-rr-webapi"
    },
    "split_keywords": [
        "raceresult",
        " api",
        " timing",
        " sports",
        " events",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "56715a52c0df38af9a057e2391dd11c15ede1c7ed99efea054084ce92406ffe6",
                "md5": "1ddab4387c63f187689d0582ad629c79",
                "sha256": "63253e75ecfa83d1a31599e3fd592d468dc6b2f2eb62f6c2b77c43911017011c"
            },
            "downloads": -1,
            "filename": "rr_webapi-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1ddab4387c63f187689d0582ad629c79",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 27097,
            "upload_time": "2025-08-19T12:15:09",
            "upload_time_iso_8601": "2025-08-19T12:15:09.419869Z",
            "url": "https://files.pythonhosted.org/packages/56/71/5a52c0df38af9a057e2391dd11c15ede1c7ed99efea054084ce92406ffe6/rr_webapi-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "54b4060cac5deb204861cf319588cc0d83902d17b3d16aa6a6c087409793f956",
                "md5": "cf9e48ab6b63c5369c68e0e46f61c2f9",
                "sha256": "09ea1a7d486766933bda6462f5b50a82666ae4d3f28ea9c7cfc331c5d0cef875"
            },
            "downloads": -1,
            "filename": "rr_webapi-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "cf9e48ab6b63c5369c68e0e46f61c2f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 25953,
            "upload_time": "2025-08-19T12:15:10",
            "upload_time_iso_8601": "2025-08-19T12:15:10.467240Z",
            "url": "https://files.pythonhosted.org/packages/54/b4/060cac5deb204861cf319588cc0d83902d17b3d16aa6a6c087409793f956/rr_webapi-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 12:15:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SPTiming",
    "github_project": "python-rr-webapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.28.0"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    ">=",
                    "2.8.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        }
    ],
    "lcname": "rr-webapi"
}
        
Elapsed time: 1.30350s