Getting ENV variables and project information usind PYTHON

Hello,
I am developing a PYTHON app that can get the values of environment variables as well as using the PANTARIS API to get the project data as JSON. This app should actually do the same as the APP you developed in NODE.JS during the on-line seminar on February 15th.

  1. So for getting the values of the environment variables I use in the following code for trying to list all env. variables:

<
import os
for item, value in os.environ.items():
print(‘{}: {}’.format(item, value))

The app running on a docker in PATARIS shows the following:

USER: web_user
LOGNAME: web_user
PATH: /
PWD: /
HOME: /home/pyodide
LANG: en_US.UTF-8
_: ./this.program

How could I get the env. variables?

  1. When trying to get the project information as JSON, I use the following Pyscript code, see also “Redirecting

<
from pyodide.http import pyfetch, FetchResponse
from typing import Optional, Any

    async def request(url: str, method: str = "GET", body: Optional[str] = None, headers: Optional[dict[str, str]] = None, **fetch_kwargs: Any) -> FetchResponse:
        kwargs = {"method": method, "mode": "cors"}  # CORS: https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
        if body and method not in ["GET", "HEAD"]:
            kwargs["body"] = body
        if headers:
            kwargs["headers"] = headers
        kwargs.update(fetch_kwargs)

        response = await pyfetch(url, **kwargs)
        return response

    async def main():
       # baseurl = "https://jsonplaceholder.typicode.com" #Reference example, working
        baseurl = "http://api.calponia.in/v2/projects/"+projectId # not working. projectId can be successfully retrieved from the cookie
        #baseurl = "http://api.calponia.in/v2/info" #not working
        
       # GET
        headers = {"Content-type": "application/json"}
        response = await request(f"{baseurl}", method="GET", headers=headers) # not working
        #response = await request(f"{baseurl}/posts/2", method="GET", headers=headers) # Reference example, working
        print(f"GET request=> status:{response.status}, json:{await response.json()}")
    asyncio.ensure_future(main())

The reference code calling the commented base url works, but when I try to use the API the browser debugger shows this warning:

Source map error: Error: request failed with status 404
Resource URL: https://cdn.pantaris.io/css/3/bundle.css
Source Map URL: bundle.css.map

So how would it be possible to get the project data as JSON file using PYTHON?

thank you and regards