ratp-api


Nameratp-api JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/tomchen/example_pypi_package
SummaryGet RATP data from RATP API.
upload_time2024-01-14 23:03:45
maintainer
docs_urlNone
authorRoméo Phillips
requires_python>=3.6
license
keywords ratp rer metro api ratp_api ratp_api-python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RatpAPI Python Wrapper

## Overview
RatpAPI is a Python wrapper for interacting with the RATP (Régie Autonome des Transports Parisiens) API. This library provides easy access to real-time traffic information, line-specific traffic details, and affluence data for journeys on the RATP network in Paris.

## Features
- Fetch global traffic information on the RATP network.
- Retrieve traffic information for specific lines using the `LineID` enum for easy reference.
- Get affluence data for journeys on particular lines.
- Utilizes Pydantic models for data validation and parsing.


## Installation
To use RatpAPI in your project, you can install it via pip:
```bash
pip install ratp-api-python
```

## Usage
a
### Setting Up
First, import the `RatpAPI` class and initialize it with your API key:

```python
from ratp_api.main import RatpAPI

api = RatpAPI()
```

### Using the LineID Enum
The `LineID` enum provides a convenient way to reference specific lines by their IDs:
```python
from ratp_api.enums import LineID

# Example: Using LineID for RER A
line_id = LineID.RER_A
```

### Fetching Global Traffic Information
To get global traffic data:
```python
global_traffic = api.get_global_traffic()
print(global_traffic)
```

### Fetching Line-Specific Traffic
To get traffic information for a specific line using the `LineID` enum:
```python
line_data = api.get_line_traffic(line_id=LineID.METRO_14)
for situation in line_data.situations:
    print(situation)
# Output:
# isActive=True isPlanned=True criticity='HIGH' messages=["Jusqu'au 04/02, le week-end, trafic interrompu sur l'ensemble de la ligne en raison de travaux. Bus de remplacement. Plus d'informations sur la page dédiée."]
# isActive=False isPlanned=True criticity='HIGH' messages=["Du 01/02 au 08/02, du lundi au jeudi à partir de 22h, trafic interrompu sur l'ensemble de la ligne en raison de travaux. Bus de remplacement. Plus d'informations sur la page dédiée."]
# isActive=False isPlanned=True criticity='HIGH' messages=["Jusqu'au 31/01, du lundi au jeudi à partir de 22h, trafic interrompu sur l'ensemble de la ligne en raison de travaux. Bus de remplacement. Plus d'informations sur la page dédiée."]

```

### Fetching Affluence for Journeys
To get affluence data for a specific journey on a line:
```python
line_id = LineID.RER_A          # Using LineID enum

affluence_data = api.get_line_affluence(line_id=line_id)
print(affluence_data)
```

### Fetching Affluence for All Lines
To get affluence data for all lines:
```python
all_lines_affluence = api.get_all_lines_affluence()
print(all_lines_affluence)
```

## Contributing
Contributions to the RatpAPI project are welcomed!

## License
This project is licensed under the MIT License.

---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tomchen/example_pypi_package",
    "name": "ratp-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "ratp,rer,metro,api,ratp_api,ratp_api-python",
    "author": "Rom\u00e9o Phillips",
    "author_email": "phillipsromeo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/99/61/d1fe33b3ed939f633ef5501dc56d639f646c1c40eda94e6dad35967c1452/ratp_api-1.0.3.tar.gz",
    "platform": null,
    "description": "# RatpAPI Python Wrapper\n\n## Overview\nRatpAPI is a Python wrapper for interacting with the RATP (R\u00e9gie Autonome des Transports Parisiens) API. This library provides easy access to real-time traffic information, line-specific traffic details, and affluence data for journeys on the RATP network in Paris.\n\n## Features\n- Fetch global traffic information on the RATP network.\n- Retrieve traffic information for specific lines using the `LineID` enum for easy reference.\n- Get affluence data for journeys on particular lines.\n- Utilizes Pydantic models for data validation and parsing.\n\n\n## Installation\nTo use RatpAPI in your project, you can install it via pip:\n```bash\npip install ratp-api-python\n```\n\n## Usage\na\n### Setting Up\nFirst, import the `RatpAPI` class and initialize it with your API key:\n\n```python\nfrom ratp_api.main import RatpAPI\n\napi = RatpAPI()\n```\n\n### Using the LineID Enum\nThe `LineID` enum provides a convenient way to reference specific lines by their IDs:\n```python\nfrom ratp_api.enums import LineID\n\n# Example: Using LineID for RER A\nline_id = LineID.RER_A\n```\n\n### Fetching Global Traffic Information\nTo get global traffic data:\n```python\nglobal_traffic = api.get_global_traffic()\nprint(global_traffic)\n```\n\n### Fetching Line-Specific Traffic\nTo get traffic information for a specific line using the `LineID` enum:\n```python\nline_data = api.get_line_traffic(line_id=LineID.METRO_14)\nfor situation in line_data.situations:\n    print(situation)\n# Output:\n# isActive=True isPlanned=True criticity='HIGH' messages=[\"Jusqu'au 04/02, le week-end, trafic interrompu sur l'ensemble de la ligne en raison de travaux. Bus de remplacement. Plus d'informations sur la page d\u00e9di\u00e9e.\"]\n# isActive=False isPlanned=True criticity='HIGH' messages=[\"Du 01/02 au 08/02, du lundi au jeudi \u00e0 partir de 22h, trafic interrompu sur l'ensemble de la ligne en raison de travaux. Bus de remplacement. Plus d'informations sur la page d\u00e9di\u00e9e.\"]\n# isActive=False isPlanned=True criticity='HIGH' messages=[\"Jusqu'au 31/01, du lundi au jeudi \u00e0 partir de 22h, trafic interrompu sur l'ensemble de la ligne en raison de travaux. Bus de remplacement. Plus d'informations sur la page d\u00e9di\u00e9e.\"]\n\n```\n\n### Fetching Affluence for Journeys\nTo get affluence data for a specific journey on a line:\n```python\nline_id = LineID.RER_A          # Using LineID enum\n\naffluence_data = api.get_line_affluence(line_id=line_id)\nprint(affluence_data)\n```\n\n### Fetching Affluence for All Lines\nTo get affluence data for all lines:\n```python\nall_lines_affluence = api.get_all_lines_affluence()\nprint(all_lines_affluence)\n```\n\n## Contributing\nContributions to the RatpAPI project are welcomed!\n\n## License\nThis project is licensed under the MIT License.\n\n---\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Get RATP data from RATP API.",
    "version": "1.0.3",
    "project_urls": {
        "Bug Reports": "https://github.com/Strvm/ratp-api-python",
        "Documentation": "https://github.com/Strvm/ratp-api-python",
        "Homepage": "https://github.com/tomchen/example_pypi_package",
        "Source Code": "https://github.com/Strvm/ratp-api-python"
    },
    "split_keywords": [
        "ratp",
        "rer",
        "metro",
        "api",
        "ratp_api",
        "ratp_api-python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "115772f05ed6372133972920fe582a18e3c29c5bb7e2afeca2d6143616a015cb",
                "md5": "8a0c69c6482ea9178982fabb1393b80a",
                "sha256": "8125d2604315c349bc89acc27e788ffc1797a29a08d5680f158d1fa568ab6b3d"
            },
            "downloads": -1,
            "filename": "ratp_api-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a0c69c6482ea9178982fabb1393b80a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7377,
            "upload_time": "2024-01-14T23:03:44",
            "upload_time_iso_8601": "2024-01-14T23:03:44.320203Z",
            "url": "https://files.pythonhosted.org/packages/11/57/72f05ed6372133972920fe582a18e3c29c5bb7e2afeca2d6143616a015cb/ratp_api-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9961d1fe33b3ed939f633ef5501dc56d639f646c1c40eda94e6dad35967c1452",
                "md5": "07e3a7615080ec2de6a9b51cf5af5249",
                "sha256": "7bd5234ee7762eee8eeb21b51ed6e35dab1cff9ce35c3ae5df0a0373ff5e752e"
            },
            "downloads": -1,
            "filename": "ratp_api-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "07e3a7615080ec2de6a9b51cf5af5249",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8200,
            "upload_time": "2024-01-14T23:03:45",
            "upload_time_iso_8601": "2024-01-14T23:03:45.949192Z",
            "url": "https://files.pythonhosted.org/packages/99/61/d1fe33b3ed939f633ef5501dc56d639f646c1c40eda94e6dad35967c1452/ratp_api-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-14 23:03:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tomchen",
    "github_project": "example_pypi_package",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "ratp-api"
}
        
Elapsed time: 0.16975s