diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/sandcrawler/grobid.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/python/sandcrawler/grobid.py b/python/sandcrawler/grobid.py index b989591..6c8450b 100644 --- a/python/sandcrawler/grobid.py +++ b/python/sandcrawler/grobid.py @@ -27,15 +27,22 @@ class GrobidClient(object): if consolidate_mode == None: consolidate_mode = self.consolidate_mode - grobid_response = requests.post( - self.host_url + "/api/processFulltextDocument", - files={ - 'input': blob, - 'consolidateHeader': self.consolidate_mode, - 'consolidateCitations': 0, # too expensive for now - 'includeRawCitations': 1, + try: + grobid_response = requests.post( + self.host_url + "/api/processFulltextDocument", + files={ + 'input': blob, + 'consolidateHeader': self.consolidate_mode, + 'consolidateCitations': 0, # too expensive for now + 'includeRawCitations': 1, + }, + timeout=180.0, + ) + except requests.Timeout: + return { + 'status': 'error-timeout', + 'status': 'GROBID request (HTTP POST) timeout', } - ) info = dict( status_code=grobid_response.status_code, |