I receive this error: "JsException: TypeError: NetworkError when attempting to fetch resource" when opening my html file that renders py-script code.
I have visited the numerous other posts on here about this error but none of them (that I've seen) seem relevant to my issue.
Here is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WeatherAPP</title>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body>
<h1>Dash</h1>
<p>bottom_line</p>
<p>getting python code...</p>
<div id="request_status"></div>
<div id="request_text"></div>
<py-script>
from pyodide.http import pyfetch
import asyncio
import json
response = await pyfetch(url="https://api.avalanche.org/v2/public/product?type=weather¢er_id=MWAC&zone_id=1307", method="GET")
status = f"Request status: {response.status}"
response_dict = await response.json()
text = f"Text: {response_dict['id']}"
pyscript.write('request_status', status)
pyscript.write('request_text', text)
</py-script>
</body>
</html>
Oddly, when I swap this API for a different, unrelated API, the pyscript succeeds and displays the result of the API that I am requesting. I've been trying to figure out why the API(s) I need do not work, and wonder if it's a matter of security, maybe.
I expected that this API would work smoothly as the other did.
TIA