Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback: Create python package to hit this API #291

Open
peterdudfield opened this issue Sep 12, 2023 · 1 comment
Open

Feedback: Create python package to hit this API #291

peterdudfield opened this issue Sep 12, 2023 · 1 comment

Comments

@peterdudfield
Copy link
Collaborator

Detailed Description

Create a python package for this api

Context

  • Makes it easier for clients using python

Possible Implementation

  • create a python package to hit each end point.
  • might want to do this in a new repo, or do this here, and make sure it matched
@JamieTaylor-TUOS
Copy link

Have coded this module... needs to be generalised a bit so you can add support for all endpoints but hopefully will be useful...

ocf_quartz_api.zip

Example Use Case

Download all forecasts covering a given period that were created during a given period

Example Usage

from datetime import datetime, time, timedelta
import pytz

from ocf_quartz_api import OCFQuartz

GSP_IDS= [0, 1, 2]
START = pytz.utc.localize(datetime.combine(date.today(), time(0, 30)))
END = pytz.utc.localize(datetime.combine(date.today()+ timedelta(days=1), time(0)))
FORECAST_START = START - timedelta(days=1)

# N.B. `ocf_creds` could also be a Path to YAML file containing these params
ocf_creds = {
    "username": "REDACTED",
    "password": "REDACTED"
}

quartz = OCFQuartz(
    credentials=ocf_creds,
    proxies=None
)

ocf_forecasts = quartz.get_forecasts(
    forecast_start=FORECAST_START ,
    forecast_end=END,
    target_start=START,
    target_end=END,
    forecast_base_times=None,
    gsp_ids=GSP_IDS
)

@peterdudfield peterdudfield changed the title Create python package to hit this API Feedback: Create python package to hit this API Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants