How do I test if a OCR.space adress is up and the response time


#1

Hello,

I tried to find a description of the api that lets you check last response time, and if a server is up.

In my program I want to check if the server is up that is about to process my image. Is there a recommended way for this?

If it is down I would try one of the other servers.

Also if one has response time over, let us say, 5 sek, I would like to choose another one. Is there a recommended way of getting the latest response time?

Thank you!


#2

Here is some example code from the open-source Copyfish OCR tool. It uses the OCR API.

Copyfish OCR API calls: https://github.com/A9T9/Copyfish/blob/1cbce8558c63c55cf79223cf741757835510fe78/scripts/cs.js#L470

It uses 3 OCR API endpoints. It first rotates them (different one for each call) and then uses the fastest one. After a certain time (one day) or if one endpoint is down, it tests again.

Our Kantu tool uses the same logic for its screen scraping with OCR feature.


#3

Thank you! Will try that. Thank you for the code example.