Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9343743
D333.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D333.diff
View Options
diff --git a/swh/core/api.py b/swh/core/api.py
--- a/swh/core/api.py
+++ b/swh/core/api.py
@@ -24,17 +24,20 @@
"""
- def __init__(self, api_exception, url):
+ def __init__(self, api_exception, url, timeout=None):
super().__init__()
self.api_exception = api_exception
base_url = url if url.endswith('/') else url + '/'
self.url = base_url
self.session = requests.Session()
+ self.timeout = timeout
def _url(self, endpoint):
return '%s%s' % (self.url, endpoint)
def raw_post(self, endpoint, data, **opts):
+ if self.timeout and 'timeout' not in opts:
+ opts['timeout'] = self.timeout
try:
return self.session.post(
self._url(endpoint),
@@ -45,6 +48,8 @@
raise self.api_exception(e)
def raw_get(self, endpoint, params=None, **opts):
+ if self.timeout and 'timeout' not in opts:
+ opts['timeout'] = self.timeout
try:
return self.session.get(
self._url(endpoint),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 1:48 PM (4 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221133
Attached To
D333: swh.core.api.SWHRemoteAPI: Permit to set a timeout option
Event Timeline
Log In to Comment