I have the following Python code for Eel
import eel, urllib.request
@eel.expose
def python_function():
response = urllib.request.urlopen('http://google.com').read()
return(response)
eel.init('web')
eel.start('index.html', port=0)
Now when I call this from JavaScript with
async function jsFunction() {
let result = await eel.python_function()();
return result;
}
I always get null
. When I call print(python_function())
from Python I get an HTML string as expected.
When testing, JavaScript returns null before the URL is reached. I thought Python blocked code. Do I need to reimplement a block? Returning a string from python_function
will get the actual string in the jsFunction
.