Getting ENV variables and project information usind PYTHON

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
PWD: /
HOME: /home/pyodide
_: ./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 “How to make HTTP requests using PyScript, in pure Python — PyScript documentation

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:
        if body and method not in ["GET", "HEAD"]:
            kwargs["body"] = body
        if headers:
            kwargs["headers"] = headers

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

    async def main():
       # baseurl = "" #Reference example, working
        baseurl = ""+projectId # not working. projectId can be successfully retrieved from the cookie
        #baseurl = "" #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()}")

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:
Source Map URL:

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

thank you and regards