Commit eb6926bd authored by zhougaofeng's avatar zhougaofeng
Browse files

Update pdf_client.py

parent 0e8f989e
...@@ -13,6 +13,20 @@ class ocrPdfClient: ...@@ -13,6 +13,20 @@ class ocrPdfClient:
def __init__(self, api_url): def __init__(self, api_url):
self.api_url = api_url self.api_url = api_url
def check_health(self):
health_check_url = f'{self.api_url}/health'
try:
response = requests.get(health_check_url)
if response.status_code == 200:
logger.info("Server is healthy and ready to process requests.")
return True
else:
logger.error(f'Server health check failed with status code:{response.status_code}')
return False
except requests.exceptions.RequestException as e:
logger.error(f'Health check request failed:{e}')
return False
def ocr_pdf_client(self, path, output_dir): def ocr_pdf_client(self, path, output_dir):
payload = { payload = {
"path": str(path), "path": str(path),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment