How to make my Python script run as fast in cursor yolo mode as it does in the command line

I have a script that uses the duckduckgo_search API. This script runs very fast in the command line, but in cursor’s yolo mode, it doesn’t even output the first line of logs. When I cancel and resume, it prompts me with the following message:
···
If the problem persists, please check your internet connection or VPN, or email us at [email protected].
Request ID:
···

here is the script: search_engine.py

I use claude-3.7-sonnet-thinking.

I have a pro account and enable usage-based pricing.

Thanks very much for your help.

This is another similar question, run_terminal_cmd does not always behave consistently with the terminal. I use cursor windows_desktop_x86_0.46.7,my project in a ubuntu 22.04 remote server(on huaweicloud).

Could it be like this issue https://forum.cursor.com/t/terminal-is-extremely-slow-to-become-available/50839