|
| 1 | +from typing import Optional |
| 2 | + |
| 3 | +from .api import Client, PandafiableResponse |
| 4 | +from .urls import ( |
| 5 | + base_url, |
| 6 | + forecast_grid_aggregations, |
| 7 | + live_grid_aggregations, |
| 8 | +) |
| 9 | + |
| 10 | + |
| 11 | +def live( |
| 12 | + collection_id: str, aggregation_id: Optional[str], **kwargs |
| 13 | +) -> PandafiableResponse: |
| 14 | + """ |
| 15 | + Get live aggregation data for up to 7 days of data at a time for a requested collection or aggregation. |
| 16 | +
|
| 17 | + Args: |
| 18 | + collection_id: a unique identifier for your collection. |
| 19 | + aggregation_id: a unique identifier that belongs to the requested collection. |
| 20 | + **kwargs: additional keyword arguments to be passed through as URL parameters to the Solcast API |
| 21 | +
|
| 22 | + See https://docs.solcast.com.au/ for full list of parameters. |
| 23 | + """ |
| 24 | + client = Client( |
| 25 | + base_url=base_url, |
| 26 | + endpoint=live_grid_aggregations, |
| 27 | + response_type=PandafiableResponse, |
| 28 | + ) |
| 29 | + |
| 30 | + return client.get( |
| 31 | + { |
| 32 | + "collection_id": collection_id, |
| 33 | + "aggregation_id": aggregation_id, |
| 34 | + "format": "json", |
| 35 | + **kwargs, |
| 36 | + } |
| 37 | + ) |
| 38 | + |
| 39 | + |
| 40 | +def forecast( |
| 41 | + collection_id: str, aggregation_id: Optional[str], **kwargs |
| 42 | +) -> PandafiableResponse: |
| 43 | + """ |
| 44 | + Get forecast aggregation data for up to 7 days of data at a time for a requested collection or aggregation. |
| 45 | +
|
| 46 | + Args: |
| 47 | + collection_id: a unique identifier for your collection. |
| 48 | + aggregation_id: a unique identifier that belongs to the requested collection. |
| 49 | + **kwargs: additional keyword arguments to be passed through as URL parameters to the Solcast API |
| 50 | +
|
| 51 | + See https://docs.solcast.com.au/ for full list of parameters. |
| 52 | + """ |
| 53 | + client = Client( |
| 54 | + base_url=base_url, |
| 55 | + endpoint=forecast_grid_aggregations, |
| 56 | + response_type=PandafiableResponse, |
| 57 | + ) |
| 58 | + |
| 59 | + return client.get( |
| 60 | + { |
| 61 | + "collection_id": collection_id, |
| 62 | + "aggregation_id": aggregation_id, |
| 63 | + "format": "json", |
| 64 | + **kwargs, |
| 65 | + } |
| 66 | + ) |
0 commit comments