Help with Handling Timeout Errors in Python API Workspace

HFL
HFL Newcomer

Hello,

I'm using the API Workspace via Python, and sometimes I encounter the following error message:
"An error occurred while requesting URL(). ReadTimeout('timed out')"

I want to handle this error using except Exception or except TimeoutError, but it doesn't seem to be recognized as an error by Python. As a result, the API call continues to function when it should terminate the process.

Could you please help me resolve this issue?

Thank you,
Hugo

Answers

  • Hello @HFL

    Could you please provide more information about the API code. What kind of query is it and how much data you are trying to access. How often do you encounter this issue.

    In general, data retrieval from Workspace is limited, and these limits are described in this guidelines document.

    You can also try to wait a bit longer by extending the timeout parameter in the library configuration:

    ld.get_config()["http.request-timeout"] = 300
    
    
  • HFL
    HFL Newcomer

    Hello,

    Thank you for your response. My question is more focused on the behavior of the process during a timeout. Specifically:

    • What happens to the ongoing get_data() call when a timeout occurs?
    • How can we properly handle this error?

    I’ve tried using except Exception and except TimeoutError, but they don’t seem to work as expected.

    I hope this provides more clarity on the issue. Looking forward to your guidance.

    Best regards,

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @HFL

    Please share the code that you using.