elexonpy


Nameelexonpy JSON
Version 1.0.15 PyPI version JSON
download
home_pageNone
SummaryElexon Python Client
upload_time2024-11-08 17:24:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseNone
keywords swagger elexon api python client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # elexonpy
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->


[![tags badge](https://img.shields.io/github/v/tag/openclimatefix/elexonpy?include_prereleases&sort=semver&color=FFAC5F)](https://github.com/openclimatefix/ocf-template/tags)
[![pypi badge](https://img.shields.io/pypi/v/elexonpy?&color=07BCDF)](https://pypi.org/project/elexonpy)
[![ease of contribution: easy](https://img.shields.io/badge/ease%20of%20contribution:%20easy-32bd50)](https://github.com/openclimatefix#how-easy-is-it-to-get-involved) 

**elexonpy** is a Python package that provides a convenient interface to the [ELEXON API](https://developer.data.elexon.co.uk/).

This package is generated using Swagger Codegen, ensuring compatibility and ease of use with the ELEXON API services.


## Installation

You can install the `elexonpy` package via pip from PyPI.

```shell
pip install elexonpy
```

## Examples usage

There are some examples in the `examples` directory that demonstrate how to use the package to retrieve data from the Elexon API.

### Example 1: Demand

This example demonstrates how to use methods from the `DemandApi` to retrieve various types of 
demand data from the Elexon API and format it into a DataFrame.


```python
# This script demonstrates the use of methods from the DemandApi
# to retrieve various types of demand data from the Elexon API.

from datetime import datetime
import pandas as pd
from elexonpy.api_client import ApiClient
from elexonpy.api.demand_api import DemandApi

# Initialize API client
api_client = ApiClient()
demand_api = DemandApi(api_client)

# Define date range for Actual Total Load Data
from_date = datetime(2024, 7, 1)
to_date = datetime(2024, 7, 2)

# Fetch Actual Total Load Data from API
df = demand_api.demand_actual_total_get(
    _from=from_date,
    to=to_date,
    settlement_period_from=1,
    settlement_period_to=48,
    format='dataframe'
)

# Print Actual Total Load Data DataFrame
print("\n--- Actual Total Load Data ---")
print(df.head())
```

### Example 2: SIP price

This example demonstrates how to use methods from the `IndicativeImbalanceSettlementApi` 
to retrieve settlement system prices data from the Elexon API and format it into a DataFrame.


<details><summary> Example 2 </summary>

```python
# This script demonstrates the use of methods from the IndicativeImbalanceSettlementApi
# to retrieve settlement system prices data from the Elexon API.


from datetime import datetime
import pandas as pd
from elexonpy.api_client import ApiClient
from elexonpy.api.indicative_imbalance_settlement_api import IndicativeImbalanceSettlementApi

## Initialize API client
api_client = ApiClient()
imbalance_settlement_api = IndicativeImbalanceSettlementApi(api_client)

# Define settlement date
settlement_date = '2024-07-02'

# Fetch system prices data from API
df = imbalance_settlement_api.balancing_settlement_system_prices_settlement_date_get(
    settlement_date=settlement_date,
    format='dataframe'
)

# Print DataFrame
print("\n--- Settlement System Prices Data ---")
print(df.head())
```

</details>



### Example 3 : DA Solar and Wind Forecast

This example demonstrates how to use methods from the `GenerationForecastApi` to retrieve 
day-ahead forecast data for wind and solar generation from the Elexon API and format it into a DataFrame.

<details><summary> Example 3 </summary>

```python
# This script demonstrates the use of methods from the GenerationForecastApi
# to retrieve day-ahead forecast data for wind and solar generation from the Elexon API.

from datetime import datetime
import pandas as pd
from elexonpy.api_client import ApiClient
from elexonpy.api.generation_forecast_api import GenerationForecastApi

# Initialize API client
api_client = ApiClient()
forecast_api = GenerationForecastApi(api_client)

# Define date range for fetching day-ahead wind and solar forecast data
from_date = datetime(2024, 7, 1)
to_date = datetime(2024, 7, 7)  # Note: Maximum data output range is 7 days

# Fetch day-ahead forecast data for wind and solar from API
df = forecast_api.forecast_generation_wind_and_solar_day_ahead_get(
    _from=from_date,
    to=to_date,
    process_type='day ahead',
    format='dataframe'
)

# Print DataFrame
print("\n--- Day-Ahead Wind and Solar Forecast Data ---")
print(df.head())
```

</details>


## Documentation 

### API Endpoints

Documentation for the API Endpoints can be found [here](./docs/DocApiEndpointsList.md)

### Models
Documentation for the Models can be found [here](./docs/DocModelsList.md)

### Authorization

 All endpoints do not require authorization.


##  FAQ

### How do I get an API key?

You dont need one. The Elexon API does not require an API key for access.

### How do I get a year worth of data?

You currently have to write a loop yourself. We hope to incorporate this into the package in the future.

## Development

To install the package directly from the GitHub repository, use the following command:

```shell
 pip install git+https://github.com/openclimatefix/Elexonpy.git
```

### Tests

To run the tests, make sure you have `pytest` installed
```bash
pip install pytest
```
and then you can run
```bash
pytest
```

## Contributing and community

[![issues badge](https://img.shields.io/github/issues/openclimatefix/elexonpy?color=FFAC5F)](https://github.com/openclimatefix/elexonpy/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)

- PR's are welcome! See the [Organisation Profile](https://github.com/openclimatefix) for details on contributing
- Find out about our other projects in the [OCF Meta Repo](https://github.com/openclimatefix/ocf-meta-repo)
- Check out the [OCF blog](https://openclimatefix.org/blog) for updates
- Follow OCF on [LinkedIn](https://uk.linkedin.com/company/open-climate-fix)


## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://richasharma.co.in/"><img src="https://avatars.githubusercontent.com/u/41283476?v=4?s=100" width="100px;" alt="Richa"/><br /><sub><b>Richa</b></sub></a><br /><a href="https://github.com/openclimatefix/Elexonpy/commits?author=14Richa" title="Code">💻</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/peterdudfield"><img src="https://avatars.githubusercontent.com/u/34686298?v=4?s=100" width="100px;" alt="Peter Dudfield"/><br /><sub><b>Peter Dudfield</b></sub></a><br /><a href="https://github.com/openclimatefix/Elexonpy/pulls?q=is%3Apr+reviewed-by%3Apeterdudfield" title="Reviewed Pull Requests">👀</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/mduffin95"><img src="https://avatars.githubusercontent.com/u/6598483?v=4?s=100" width="100px;" alt="Matthew Duffin"/><br /><sub><b>Matthew Duffin</b></sub></a><br /><a href="#ideas-mduffin95" title="Ideas, Planning, & Feedback">🤔</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/Jacqueline-J"><img src="https://avatars.githubusercontent.com/u/108654780?v=4?s=100" width="100px;" alt="Jacqueline James"/><br /><sub><b>Jacqueline James</b></sub></a><br /><a href="https://github.com/openclimatefix/Elexonpy/commits?author=Jacqueline-J" title="Code">💻</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/yousefsawy"><img src="https://avatars.githubusercontent.com/u/99139949?v=4?s=100" width="100px;" alt="Yousef Elsawy"/><br /><sub><b>Yousef Elsawy</b></sub></a><br /><a href="https://github.com/openclimatefix/Elexonpy/commits?author=yousefsawy" title="Documentation">📖</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/Sigma-Verma"><img src="https://avatars.githubusercontent.com/u/131307209?v=4?s=100" width="100px;" alt="Utkarsh Verma"/><br /><sub><b>Utkarsh Verma</b></sub></a><br /><a href="#maintenance-Sigma-Verma" title="Maintenance">🚧</a></td>
      <td align="center" valign="top" width="14.28%"><a href="http://anaskhan.me"><img src="https://avatars.githubusercontent.com/u/83116240?v=4?s=100" width="100px;" alt="Anas Khan"/><br /><sub><b>Anas Khan</b></sub></a><br /><a href="#maintenance-anxkhn" title="Maintenance">🚧</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!


*Part of the [Open Climate Fix](https://github.com/orgs/openclimatefix/people) community.*

[![OCF Logo](https://cdn.prod.website-files.com/62d92550f6774db58d441cca/6324a2038936ecda71599a8b_OCF_Logo_black_trans.png)](https://openclimatefix.org)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "elexonpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Swagger, Elexon API, Python Client",
    "author": null,
    "author_email": "Richa Sharma <onlinericha19@gmail.com>, Peter Dudfield <info@openclimatefix.org>",
    "download_url": "https://files.pythonhosted.org/packages/57/db/9740818e43bedfe4f2b82c2843a9b0a77fcaf9dc09d0aac24e36dda74621/elexonpy-1.0.15.tar.gz",
    "platform": null,
    "description": "# elexonpy\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\n\n[![tags badge](https://img.shields.io/github/v/tag/openclimatefix/elexonpy?include_prereleases&sort=semver&color=FFAC5F)](https://github.com/openclimatefix/ocf-template/tags)\n[![pypi badge](https://img.shields.io/pypi/v/elexonpy?&color=07BCDF)](https://pypi.org/project/elexonpy)\n[![ease of contribution: easy](https://img.shields.io/badge/ease%20of%20contribution:%20easy-32bd50)](https://github.com/openclimatefix#how-easy-is-it-to-get-involved) \n\n**elexonpy** is a Python package that provides a convenient interface to the [ELEXON API](https://developer.data.elexon.co.uk/).\n\nThis package is generated using Swagger Codegen, ensuring compatibility and ease of use with the ELEXON API services.\n\n\n## Installation\n\nYou can install the `elexonpy` package via pip from PyPI.\n\n```shell\npip install elexonpy\n```\n\n## Examples usage\n\nThere are some examples in the `examples` directory that demonstrate how to use the package to retrieve data from the Elexon API.\n\n### Example 1: Demand\n\nThis example demonstrates how to use methods from the `DemandApi` to retrieve various types of \ndemand data from the Elexon API and format it into a DataFrame.\n\n\n```python\n# This script demonstrates the use of methods from the DemandApi\n# to retrieve various types of demand data from the Elexon API.\n\nfrom datetime import datetime\nimport pandas as pd\nfrom elexonpy.api_client import ApiClient\nfrom elexonpy.api.demand_api import DemandApi\n\n# Initialize API client\napi_client = ApiClient()\ndemand_api = DemandApi(api_client)\n\n# Define date range for Actual Total Load Data\nfrom_date = datetime(2024, 7, 1)\nto_date = datetime(2024, 7, 2)\n\n# Fetch Actual Total Load Data from API\ndf = demand_api.demand_actual_total_get(\n    _from=from_date,\n    to=to_date,\n    settlement_period_from=1,\n    settlement_period_to=48,\n    format='dataframe'\n)\n\n# Print Actual Total Load Data DataFrame\nprint(\"\\n--- Actual Total Load Data ---\")\nprint(df.head())\n```\n\n### Example 2: SIP price\n\nThis example demonstrates how to use methods from the `IndicativeImbalanceSettlementApi` \nto retrieve settlement system prices data from the Elexon API and format it into a DataFrame.\n\n\n<details><summary> Example 2 </summary>\n\n```python\n# This script demonstrates the use of methods from the IndicativeImbalanceSettlementApi\n# to retrieve settlement system prices data from the Elexon API.\n\n\nfrom datetime import datetime\nimport pandas as pd\nfrom elexonpy.api_client import ApiClient\nfrom elexonpy.api.indicative_imbalance_settlement_api import IndicativeImbalanceSettlementApi\n\n## Initialize API client\napi_client = ApiClient()\nimbalance_settlement_api = IndicativeImbalanceSettlementApi(api_client)\n\n# Define settlement date\nsettlement_date = '2024-07-02'\n\n# Fetch system prices data from API\ndf = imbalance_settlement_api.balancing_settlement_system_prices_settlement_date_get(\n    settlement_date=settlement_date,\n    format='dataframe'\n)\n\n# Print DataFrame\nprint(\"\\n--- Settlement System Prices Data ---\")\nprint(df.head())\n```\n\n</details>\n\n\n\n### Example 3 : DA Solar and Wind Forecast\n\nThis example demonstrates how to use methods from the `GenerationForecastApi` to retrieve \nday-ahead forecast data for wind and solar generation from the Elexon API and format it into a DataFrame.\n\n<details><summary> Example 3 </summary>\n\n```python\n# This script demonstrates the use of methods from the GenerationForecastApi\n# to retrieve day-ahead forecast data for wind and solar generation from the Elexon API.\n\nfrom datetime import datetime\nimport pandas as pd\nfrom elexonpy.api_client import ApiClient\nfrom elexonpy.api.generation_forecast_api import GenerationForecastApi\n\n# Initialize API client\napi_client = ApiClient()\nforecast_api = GenerationForecastApi(api_client)\n\n# Define date range for fetching day-ahead wind and solar forecast data\nfrom_date = datetime(2024, 7, 1)\nto_date = datetime(2024, 7, 7)  # Note: Maximum data output range is 7 days\n\n# Fetch day-ahead forecast data for wind and solar from API\ndf = forecast_api.forecast_generation_wind_and_solar_day_ahead_get(\n    _from=from_date,\n    to=to_date,\n    process_type='day ahead',\n    format='dataframe'\n)\n\n# Print DataFrame\nprint(\"\\n--- Day-Ahead Wind and Solar Forecast Data ---\")\nprint(df.head())\n```\n\n</details>\n\n\n## Documentation \n\n### API Endpoints\n\nDocumentation for the API Endpoints can be found [here](./docs/DocApiEndpointsList.md)\n\n### Models\nDocumentation for the Models can be found [here](./docs/DocModelsList.md)\n\n### Authorization\n\n All endpoints do not require authorization.\n\n\n##  FAQ\n\n### How do I get an API key?\n\nYou dont need one. The Elexon API does not require an API key for access.\n\n### How do I get a year worth of data?\n\nYou currently have to write a loop yourself. We hope to incorporate this into the package in the future.\n\n## Development\n\nTo install the package directly from the GitHub repository, use the following command:\n\n```shell\n pip install git+https://github.com/openclimatefix/Elexonpy.git\n```\n\n### Tests\n\nTo run the tests, make sure you have `pytest` installed\n```bash\npip install pytest\n```\nand then you can run\n```bash\npytest\n```\n\n## Contributing and community\n\n[![issues badge](https://img.shields.io/github/issues/openclimatefix/elexonpy?color=FFAC5F)](https://github.com/openclimatefix/elexonpy/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)\n\n- PR's are welcome! See the [Organisation Profile](https://github.com/openclimatefix) for details on contributing\n- Find out about our other projects in the [OCF Meta Repo](https://github.com/openclimatefix/ocf-meta-repo)\n- Check out the [OCF blog](https://openclimatefix.org/blog) for updates\n- Follow OCF on [LinkedIn](https://uk.linkedin.com/company/open-climate-fix)\n\n\n## Contributors \u2728\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://richasharma.co.in/\"><img src=\"https://avatars.githubusercontent.com/u/41283476?v=4?s=100\" width=\"100px;\" alt=\"Richa\"/><br /><sub><b>Richa</b></sub></a><br /><a href=\"https://github.com/openclimatefix/Elexonpy/commits?author=14Richa\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/peterdudfield\"><img src=\"https://avatars.githubusercontent.com/u/34686298?v=4?s=100\" width=\"100px;\" alt=\"Peter Dudfield\"/><br /><sub><b>Peter Dudfield</b></sub></a><br /><a href=\"https://github.com/openclimatefix/Elexonpy/pulls?q=is%3Apr+reviewed-by%3Apeterdudfield\" title=\"Reviewed Pull Requests\">\ud83d\udc40</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/mduffin95\"><img src=\"https://avatars.githubusercontent.com/u/6598483?v=4?s=100\" width=\"100px;\" alt=\"Matthew Duffin\"/><br /><sub><b>Matthew Duffin</b></sub></a><br /><a href=\"#ideas-mduffin95\" title=\"Ideas, Planning, & Feedback\">\ud83e\udd14</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/Jacqueline-J\"><img src=\"https://avatars.githubusercontent.com/u/108654780?v=4?s=100\" width=\"100px;\" alt=\"Jacqueline James\"/><br /><sub><b>Jacqueline James</b></sub></a><br /><a href=\"https://github.com/openclimatefix/Elexonpy/commits?author=Jacqueline-J\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/yousefsawy\"><img src=\"https://avatars.githubusercontent.com/u/99139949?v=4?s=100\" width=\"100px;\" alt=\"Yousef Elsawy\"/><br /><sub><b>Yousef Elsawy</b></sub></a><br /><a href=\"https://github.com/openclimatefix/Elexonpy/commits?author=yousefsawy\" title=\"Documentation\">\ud83d\udcd6</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/Sigma-Verma\"><img src=\"https://avatars.githubusercontent.com/u/131307209?v=4?s=100\" width=\"100px;\" alt=\"Utkarsh Verma\"/><br /><sub><b>Utkarsh Verma</b></sub></a><br /><a href=\"#maintenance-Sigma-Verma\" title=\"Maintenance\">\ud83d\udea7</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"http://anaskhan.me\"><img src=\"https://avatars.githubusercontent.com/u/83116240?v=4?s=100\" width=\"100px;\" alt=\"Anas Khan\"/><br /><sub><b>Anas Khan</b></sub></a><br /><a href=\"#maintenance-anxkhn\" title=\"Maintenance\">\ud83d\udea7</a></td>\n    </tr>\n  </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n\n*Part of the [Open Climate Fix](https://github.com/orgs/openclimatefix/people) community.*\n\n[![OCF Logo](https://cdn.prod.website-files.com/62d92550f6774db58d441cca/6324a2038936ecda71599a8b_OCF_Logo_black_trans.png)](https://openclimatefix.org)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Elexon Python Client",
    "version": "1.0.15",
    "project_urls": {
        "Homepage": "https://github.com/openclimatefix/Elexonpy",
        "Source Code": "https://github.com/openclimatefix/Elexonpy"
    },
    "split_keywords": [
        "swagger",
        " elexon api",
        " python client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ab9c492735c7bb06cda758180c7d37a484938835af5f1c86dbaf31bc2a6f976",
                "md5": "363fc719e03e5b5e76cc0eb10372606c",
                "sha256": "66d1185b1050cd27f3cf8d013a7d55582c509ecc0c5035bdc66b5e4ae534f8dd"
            },
            "downloads": -1,
            "filename": "elexonpy-1.0.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "363fc719e03e5b5e76cc0eb10372606c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 618073,
            "upload_time": "2024-11-08T17:24:29",
            "upload_time_iso_8601": "2024-11-08T17:24:29.815289Z",
            "url": "https://files.pythonhosted.org/packages/0a/b9/c492735c7bb06cda758180c7d37a484938835af5f1c86dbaf31bc2a6f976/elexonpy-1.0.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57db9740818e43bedfe4f2b82c2843a9b0a77fcaf9dc09d0aac24e36dda74621",
                "md5": "96d52dbfa90d79de9863d75a9561a6f1",
                "sha256": "af067eba9a9151e46d76f3b2541380e0cee40d2e1b56dec1da2dad1f6e967227"
            },
            "downloads": -1,
            "filename": "elexonpy-1.0.15.tar.gz",
            "has_sig": false,
            "md5_digest": "96d52dbfa90d79de9863d75a9561a6f1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 231281,
            "upload_time": "2024-11-08T17:24:31",
            "upload_time_iso_8601": "2024-11-08T17:24:31.782618Z",
            "url": "https://files.pythonhosted.org/packages/57/db/9740818e43bedfe4f2b82c2843a9b0a77fcaf9dc09d0aac24e36dda74621/elexonpy-1.0.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-08 17:24:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "openclimatefix",
    "github_project": "Elexonpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "elexonpy"
}
        
Elapsed time: 9.50310s