How to get around CORS issue with fetch(url)

I am doing a very simple fetch(url) to a URL at localhost/cma_mysql/getstuff.php?username=ppowell777 from localhost:8000/login.html using Python scripts.

The PHP portion that connects to my local MySQL platform works just fine on its own, retrieving data if found and returning a JSON array string, however, localhost:8000/login.html, using fetch(url), can’t reach it itself due to CORS error.

I have tried everything I can think of, and I visited several tutorials on the matter, and everything I tried was blocked by the browser, and since this is my own CMA on my browser on my laptop and nowhere else on earth, I would only need to fix this ultimately for myself at the moment.

Here is the Python code I used to try to connect to the “remote” URL:

import asyncio, logging 
#from pyodide.http import pyfetch
from js import JSON
from pyscript import fetch

'''
	MySQL is not accessible via PyScript, therefore, you will have to do a URL scrape to a PHP stub on the IIS web server that can access
	MySQL for you and perform necessary tasks to return to the PyScript-based CMA
	
	Re:  stackoverflow.com/questions/75054667/pyscript-website-showing-no-module-named-mysql
'''

def getLoginCredz(username):
	logger = logging.getLogger(__name__)
	if username is None or len(username.strip()) == 0:
		error = 'username not provided for getLoginCredz()'
		logger.error(error)
		raise EOFError(error)
		
	try:
		loop = asyncio.get_event_loop()
		loop.run_until_complete(getUrlBody(LOGIN_SELECT_URL + username))
		print(JSON.stringify(json))
	except EOFError as error:
		logger.error(error)
		raise
		
async def getUrlBody(url):
	global json
	json = ''
	logger = logging.getLogger(__name__)
	if url is None or len(url.strip()) == 0:
		error = 'url not provided for getUrlBody()'
		logger.error(error)
		raise EOFError(error)
	
	try:
		response = await fetch(url)
		json = await response.json
	except NameError as error:
		logger.error(error)
		raise

I solved it by completely doing away with fetch() altogether and sticking with pyodide.http.open_url(url) instead; that works beautifully to retrieve url content while sending query string data:

# FOR A GET RETRIEVAL VIA URL (E.G. LOGIN)					
def retrieveUrlBody(url):
	logger = logging.getLogger(__name__)
	if url is None or len(url.strip()) == 0:
		error = 'url not provided for retrieveUrlBody()'
		logger.error(error)
		raise EOFError(error)

	try:
		data = open_url(url)
		os.environ[JSON_RESULTS] = data.read()
	except NameError as error:
		logger.error(error)
		raise
	except TypeError as error2:
		logger.error(error2)
		raise
	except:
		logger.error('Unable to run retrieveUrlBody()')
		raise