##// END OF EJS Templates
requests: added a default timeout for operation calling the endpoint url....
marcink -
r2950:d70230db default
parent child Browse files
Show More
@@ -133,7 +133,7 b' class LoginView(BaseAppView):'
133 'response': captcha_rs,
133 'response': captcha_rs,
134 'remoteip': get_ip_addr(self.request.environ)
134 'remoteip': get_ip_addr(self.request.environ)
135 }
135 }
136 verify_rs = requests.get(url, params=params, verify=True)
136 verify_rs = requests.get(url, params=params, verify=True, timeout=60)
137 verify_rs = verify_rs.json()
137 verify_rs = verify_rs.json()
138 captcha_status = verify_rs.get('success', False)
138 captcha_status = verify_rs.get('success', False)
139 captcha_errors = verify_rs.get('error-codes', [])
139 captcha_errors = verify_rs.get('error-codes', [])
@@ -243,9 +243,11 b' class HipchatIntegrationType(Integration'
243 @async_task(ignore_result=True, base=RequestContextTask)
243 @async_task(ignore_result=True, base=RequestContextTask)
244 def post_text_to_hipchat(settings, text):
244 def post_text_to_hipchat(settings, text):
245 log.debug('sending %s to hipchat %s' % (text, settings['server_url']))
245 log.debug('sending %s to hipchat %s' % (text, settings['server_url']))
246 resp = requests.post(settings['server_url'], json={
246 json_message = {
247 "message": text,
247 "message": text,
248 "color": settings.get('color', 'yellow'),
248 "color": settings.get('color', 'yellow'),
249 "notify": settings.get('notify', False),
249 "notify": settings.get('notify', False),
250 })
250 }
251
252 resp = requests.post(settings['server_url'], json=json_message, timeout=60)
251 resp.raise_for_status() # raise exception on a failed request
253 resp.raise_for_status() # raise exception on a failed request
@@ -346,5 +346,5 b' def post_text_to_slack(settings, title, '
346 "attachments": [message_data]
346 "attachments": [message_data]
347 }
347 }
348
348
349 resp = requests.post(settings['service'], json=json_message)
349 resp = requests.post(settings['service'], json=json_message, timeout=60)
350 resp.raise_for_status() # raise exception on a failed request
350 resp.raise_for_status() # raise exception on a failed request
@@ -264,7 +264,7 b' def post_to_webhook(url_calls, settings)'
264 resp = call_method(url, json={
264 resp = call_method(url, json={
265 'token': token,
265 'token': token,
266 'event': data
266 'event': data
267 }, headers=call_headers, auth=auth)
267 }, headers=call_headers, auth=auth, timeout=60)
268 log.debug('Got Webhook response: %s', resp)
268 log.debug('Got Webhook response: %s', resp)
269
269
270 try:
270 try:
General Comments 0
You need to be logged in to leave comments. Login now