1 scene reproduction
Related tools and versions:
fastapi==0.95.0
trafilatura==1.5.0
python==3.10
Use FastAPI to develop an interface for obtaining URL content:
the exceptions thrown are as follows:
File “/app/src/utils/file_process_util.py”, line 66, in request_data_from_url
text = trafilatura.extract(source_data)
File “/usr/local/lib/python3.10/site-packages/trafilatura/core.py”, line 1050, in extract
signal(SIGALRM, timeout_handler)
File “/usr/local/lib/python3.10/signal.py”, line 56, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread of the main interpreter
2 codes
import trafilatura
def request_data_from_url