Aug-18-2022, 09:07 PM
This question is about Cython converting python to C, C++ code
I have tried all kinds of ways to add data types that would make my python stuff work with c. Actually C++ but that doesn't matter. I have taken these out and my code compiles. What it is used for is to correct html errors and conveniently get text and resources from the web page. I haven't even tried to add it to a C++ project because I don't think it will work as is.
this is my code:
[
I have tried all kinds of ways to add data types that would make my python stuff work with c. Actually C++ but that doesn't matter. I have taken these out and my code compiles. What it is used for is to correct html errors and conveniently get text and resources from the web page. I haven't even tried to add it to a C++ project because I don't think it will work as is.
this is my code:
[
from urllib.error import HTTPError
from urllib.error import URLError
import requests
from bs4 import BeautifulSoup as beus
def parseTool(aurl):
try:
html = requests.get(aurl)
bsobj = beus(html, 'html.parser')
ret = bsobj.prettify()
except HTTPError as e:
ret = "http error"
except URLError as e:
ret = "url error"
else:
pass
return ret
def objectTool(aurl):
try:
ret = requests.get(aurl)
except HTTPError as e:
ret = "http error"
except URLError as e:
ret = "url error"
else:
pass
return ret the objectTool I could use 2 of them one for text and another for the resources (like images)
