I'm trying to display the results of a python query in html. I have the following error and I can't find the solution. I leave code. Thank you for your support
I expected it to show the name of a product, its price and the supermarket but i got this error
JsException(PythonError: Traceback (most recent call last): File "/lib/python3.10/site-packages/_pyodide/_base.py", line 429, in eval_code .run(globals, locals) File "/lib/python3.10/site-packages/_pyodide/_base.py", line 300, in run coroutine = eval(self.code, globals, locals) File "", line 1, in ModuleNotFoundError: No module named 'bs4' )
code
python
- plotly-express
from bs4 import BeautifulSoup
import requests
import time
import webbrowser
import webbrowser
print("Accediendo a la web..")
print('.')
time.sleep(2)
url = 'https://www.jumbo.cl/salchichas-llanquihue-250-g-5-unida-2/p'
page = requests.get(url)
soup_jumbo = BeautifulSoup(page.content, 'html.parser')
titulo = soup_jumbo.find(attrs={"property":"twitter:title"}).get_attribute_list("content", "")
precio = soup_jumbo.find(attrs={"property":"product:price:amount"}).get_attribute_list("content", "")
print("Producto", titulo)
print("Precio ", precio)
print('.')
time.sleep(1)
url = 'https://www.santaisabel.cl/salchichas-llanquihue-250-g-5-unida-2/p'
page1 = requests.get(url)
soup_santai = BeautifulSoup(page1.content, 'html.parser')
titulo1 = soup_santai.find(attrs={"property":"twitter:title"}).get_attribute_list("content", "")
site1 = soup_santai.find(attrs={"property":"twitter:site"}).get_attribute_list("content", "")
precio1 = soup_santai.find(attrs={"property":"product:price:amount"}).get_attribute_list("content", "")
print("Producto", titulo1, site1)
print("Precio ", precio1)
print('.')
time.sleep(1)
url = 'https://www.jumbo.cl/cafe-instantaneo-nescafe-tradicion-170-g/p'
page2 = requests.get(url)
soup_jumbo2 = BeautifulSoup(page2.content, 'html.parser')
titulo2 = soup_jumbo2.find(attrs={"property":"twitter:title"}).get_attribute_list("content", "")
precio2 = soup_jumbo2.find(attrs={"property":"product:price:amount"}).get_attribute_list("content", "")
print("Producto", titulo2)
print("Precio ", precio2)
print('.')
time.sleep(1)
print('.')
time.sleep(10)