openclimatefix / uk-pv-national-gsp-api

API for hosting nowcasting solar predictions
MIT License
6 stars 10 forks source link

Some clients cant access api.quartz/solar #292

Closed peterdudfield closed 8 months ago

peterdudfield commented 1 year ago

api.nowcasting.io works but api.quatz.solar doesnt. This is from a jupyter notebook. The web broswer it worked fine. This might be connected to the same client can view app.nowcasting.io but not app.quartz.solar

---------------------------------------------------------------------------OSError                                   Traceback (most recent call last)
File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\urllib3\connectionpool.py:776, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)    775 try:--> 776     self._prepare_proxy(conn)    777 except (BaseSSLError, OSError, SocketTimeout) as e:

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\urllib3\connectionpool.py:1041, in HTTPSConnectionPool._prepare_proxy(self, conn)   1035 conn.set_tunnel(   1036     scheme=tunnel_scheme,   1037     host=self._tunnel_host,   1038     port=self.port,   1039     headers=self.proxy_headers,   1040 )-> 1041 conn.connect()

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\urllib3\connection.py:625, in HTTPSConnection.connect(self)    623 self._has_connected_to_proxy = True--> 625 self._tunnel()  # type: ignore[attr-defined]    626 # Override the host with the one we're requesting data from.
File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\http\client.py:926, in HTTPConnection._tunnel(self)    925     self.close()--> 926     raise OSError(f"Tunnel connection failed: {code} {message.strip()}")    927 while True:
OSError: Tunnel connection failed: 403 Forbidden

The above exception was the direct cause of the following exception:
ProxyError                                Traceback (most recent call last)ProxyError: ('Unable to connect to proxy', OSError('Tunnel connection failed: 403 Forbidden'))

The above exception was the direct cause of the following exception:
MaxRetryError                             Traceback (most recent call last)
File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\requests\adapters.py:486, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)    485 try:--> 486     resp = conn.urlopen(    487         method=request.method,    488         url=url,    489         body=request.body,    490         headers=request.headers,    491         redirect=False,    492         assert_same_host=False,    493         preload_content=False,    494         decode_content=False,    495         retries=self.max_retries,    496         timeout=timeout,    497         chunked=chunked,    498     )    500 except (ProtocolError, OSError) as err:

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\urllib3\connectionpool.py:844, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)    842     new_e = ProtocolError("Connection aborted.", new_e)--> 844 retries = retries.increment(    845     method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]    846 )    847 retries.sleep()

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\urllib3\util\retry.py:515, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)    514     reason = error or ResponseError(cause)--> 515     raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]    517 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
MaxRetryError: HTTPSConnectionPool(host='api.quartz.solar', port=443): Max retries exceeded with url: /v0/solar/GB/national/forecast?historic=true& (Caused by ProxyError('Unable to connect to proxy', OSError('Tunnel connection failed: 403 Forbidden')))

During handling of the above exception, another exception occurred:
ProxyError                                Traceback (most recent call last)
Cell In[31], line 3      1 url = "https://api.quartz.solar/v0/solar/GB/national/forecast?historic=true&"      2 # url = "https://api.nowcasting.io/v0/solar/GB/national/forecast?historic=true&"----> 3 r = requests.get(      4     url=url,      5     headers={"Authorization": "Bearer "+access_token},      6     proxies=PROXIES,      7     verify=False,      8 )     10 data = r.json()

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\requests\api.py:73, in get(url, params, **kwargs)     62 def get(url, params=None, **kwargs):     63     r"""Sends a GET request.     64      65     :param url: URL for the new :class:`Request` object.   (...)     70     :rtype: requests.Response     71     """---> 73     return request("get", url, params=params, **kwargs)

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\requests\api.py:59, in request(method, url, **kwargs)     55 # By using the 'with' statement we are sure the session is closed, thus we     56 # avoid leaving sockets open which can trigger a ResourceWarning in some     57 # cases, and look like a memory leak in others.     58 with sessions.Session() as session:---> 59     return session.request(method=method, url=url, **kwargs)

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\requests\sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)    584 send_kwargs = {    585     "timeout": timeout,    586     "allow_redirects": allow_redirects,    587 }    588 send_kwargs.update(settings)--> 589 resp = self.send(prep, **send_kwargs)    591 return resp

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\requests\sessions.py:703, in Session.send(self, request, **kwargs)    700 start = preferred_clock()    702 # Send the request--> 703 r = adapter.send(request, **kwargs)    705 # Total elapsed time of the request (approximately)    706 elapsed = preferred_clock() - start

File ~\AppData\Local\anaconda3\envs\energy_forecasting_tools\Lib\site-packages\requests\adapters.py:513, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)    510     raise RetryError(e, request=request)    512 if isinstance(e.reason, _ProxyError):
--> 513     raise ProxyError(e, request=request)
    515 if isinstance(e.reason, _SSLError):
    516     # This branch is for urllib3 v1.22 and later.
    517     raise SSLError(e, request=request)

ProxyError: HTTPSConnectionPool(host='api.quartz.solar', port=443): Max retries exceeded with url: /v0/solar/GB/national/forecast?historic=true& (Caused by ProxyError('Unable to connect to proxy', OSError('Tunnel connection failed: 403 Forbidden')))
peterdudfield commented 1 year ago

I turned this on, as it was on on nowcasting.io. It takes ~24 hours to turn on Screenshot 2023-09-12 at 14 54 29

peterdudfield commented 8 months ago

Ill close this for now