Commit fa08a5b3 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update InvenioStore.interogate to handle properly RequestException and timeout.

parent 3fe0d5c1
""" invenio_tools.inveniostore
"""
import json
import re
import requests
import time
from .exception import CdsException
from requests.adapters import HTTPAdapter
......@@ -55,7 +52,7 @@ class InvenioStore(object):
# close the session
self._session.close()
def interogate(self, url, timeout=10, params=None):
def interogate(self, url, timeout=10, **kwargs):
"""Interrogate the store using the *URL*.
It is retry several time when the service is not available.
......@@ -66,6 +63,9 @@ class InvenioStore(object):
* ``https://cds.cern.ch/record/123456/of=recjson``
* ``https://cds.cern.ch/search?of=id&....
timeout (float):
timeout for the HTTP request
Keyword Args:
The keyword arguments are those of the invenio web interface.
......@@ -293,7 +293,7 @@ class InvenioStore(object):
"""
self._url = url
r = self._session.get(url, timeout=timeout, params=params)
r = self._session.get(url, timeout=timeout, params=kwargs)
r.raise_for_status()
return r
......
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