pvoutput icon indicating copy to clipboard operation
pvoutput copied to clipboard

_get_data_service_response uses service endpoint, should use data endpoint

Open JulianBriggs opened this issue 3 years ago • 2 comments
trafficstars

Describe the bug _get_data_service_response incorrectly sets api_url api_url = urljoin(self.data_service_url, "service/r2/{}.jsp".format(service)) should b
api_url api_url = urljoin(self.data_service_url, "data/r2/{}.jsp".format(service))

To Reproduce Steps to reproduce the behavior:

  1. Set DEBUG=True
  2. call get_status(...,use_data_service=True)
  3. connectionpool _make_request 456 DEBUG https://pvoutput.org:443 "GET /service/r2/getstatus.jsp?...

Expected behavior expect connectionpool _make_request 456 DEBUG https://pvoutput.org:443 "GET /data/r2/getstatus.jsp?

Additional context def _get_data_service_response(self, service: str, api_params: Dict) -> requests.Response: """ Args: service: string, e.g. 'getbatchstatus' api_params: dict """ self._check_api_params() if self.data_service_url is None: raise ValueError("data_service_url must be set to use the data service!")

    headers = {"X-Rate-Limit": "1"}
    api_params = api_params.copy()
    api_params["key"] = self.api_key
    api_params["sid"] = self.system_id

    api_url = urljoin(self.data_service_url, "service/r2/{}.jsp".format(service))

    return _get_response(api_url, api_params, headers)

JulianBriggs avatar Jan 24 '22 13:01 JulianBriggs

did you manage to find a fix to this?

peterdudfield avatar Feb 03 '22 16:02 peterdudfield

Hi,

Initially I edited a copy of the pvoutput.py module as a workaround. But since then I have developed a pvoutput downloader lite. I could dredge up my workaround if you are interested.

best Julian

On Thu, 3 Feb 2022 at 16:18, Peter Dudfield @.***> wrote:

did you manage to find a fix to this?

— Reply to this email directly, view it on GitHub https://github.com/openclimatefix/pvoutput/issues/86#issuecomment-1029157565, or unsubscribe https://github.com/notifications/unsubscribe-auth/APAUAOJY7SK6CJNE7J6ENXTUZKTG7ANCNFSM5MVN6RQQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Julian Briggs Research Software Developer Sheffield Solar Physics & Astronomy University of Sheffield In line with government advice, I am currently working remotely. My preferred method of contact is email. My normal working hours are 9:30-5 Mon-Thu

JulianBriggs avatar Feb 05 '22 18:02 JulianBriggs