Alternative function for deprecated cgi

To my surprise, I received the following warning in my Apach system:
DeprecationWarning: ‘cgi’ is deprecated and slated for removal in Python 3.13.

I need the function cgi.FieldStorage() for extracting parameters from each Internet request from my web system such as ‘?aaa=111&bbbb=222&ccc=333’.

What is the best alternative function for cgi?

Check the cgi module docs. It gives you alternatives right at the top.

That document is telling, that the function ‘urllib.parse.parse_qsl’ can be used for the requset method ‘GET’ and the function ‘email.message’ for ‘POST’. Because I’m not expert in Python. My current function contains as follows:

wrktbl = cgi.FieldStorage()
    for wrkkey in wrktbl:
      if isinstance(wrktbl[wrkkey], list):
        wrkvlx = wrktbl[wrkkey][0].value
      else:
        wrkvlx = wrktbl[wrkkey].value
      tblrqs[wrkkey] = wrkvlx

I wonder, whether anybody can convert that code for me. For instance:

import os
import urllib.parse.parse_qsl
import email.message
if os.environ('REQUEST_MODE') == 'GET':
    .......
   # How to get input and to convert to the variable table 'tblrqs'
   .......
else if os.environ('REQUEST_MODE') == 'POST':
    .......
   # How to get input and to convert to the variable table 'tblrqs'
   .......

As for the GET request parameters, I am able to extract them from the os.environ(‘QUERY_STRING’).
As for the POST request parameters, unfortunately I don’t see in the document ‘multipart’, how to extract the POST request parameters from wheret. Can I get any help from you for it? If yes, rather give me a clear example.