Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
fa08a5b3
Commit
fa08a5b3
authored
Jan 30, 2020
by
LE GAC Renaud
Browse files
Update InvenioStore.interogate to handle properly RequestException and timeout.
parent
3fe0d5c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
modules/invenio_tools/inveniostore.py
modules/invenio_tools/inveniostore.py
+5
-5
No files found.
modules/invenio_tools/inveniostore.py
View file @
fa08a5b3
""" 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
=
param
s
)
r
=
self
.
_session
.
get
(
url
,
timeout
=
timeout
,
params
=
kwarg
s
)
r
.
raise_for_status
()
return
r
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment