Skip to content

Commit

Permalink
Use Timeout instead of ConnectTimeout to really support requests 2.1+.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarranz authored and Alejandro Rodriguez committed Jul 24, 2017
1 parent 5c81786 commit 00af389
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/wirecloud/fiware/marketAdaptor/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from requests.exceptions import ConnectionError, ConnectTimeout
from requests.exceptions import ConnectionError, Timeout

from wirecloud.commons.baseviews import Resource, Service
from wirecloud.commons.utils.http import authentication_required, build_error_response, get_absolute_reverse_url, consumes, parse_json_request, produces
Expand Down Expand Up @@ -84,7 +84,7 @@ def read(self, request, market_user, market_name, store):
except HTTPError as e:
details = "%s" % e
return build_error_response(request, 502, "Unexpected response", details=details)
except (ConnectionError, ConnectTimeout):
except (ConnectionError, Timeout):
return build_error_response(request, 504, "Connection Error")

return HttpResponse(json.dumps(result, sort_keys=True), content_type='application/json; charset=UTF-8')
Expand All @@ -103,7 +103,7 @@ def read(self, request, market_user, market_name, store='', search_string='widge
except HTTPError as e:
details = "%s" % e
return build_error_response(request, 502, "Unexpected response", details=details)
except (ConnectionError, ConnectTimeout):
except (ConnectionError, Timeout):
return build_error_response(request, 504, "Connection Error")

return HttpResponse(json.dumps(result, sort_keys=True), content_type='application/json; chaset=UTF-8')
Expand All @@ -122,7 +122,7 @@ def read(self, request, market_user, market_name, store, offering_id):
except HTTPError as e:
details = "%s" % e
return build_error_response(request, 502, "Unexpected response", details=details)
except (ConnectionError, ConnectTimeout):
except (ConnectionError, Timeout):
return build_error_response(request, 504, "Connection Error")

return HttpResponse(json.dumps(offering_info, sort_keys=True), content_type='application/json; charset=UTF-8')
Expand All @@ -145,7 +145,7 @@ def read(self, request, market_user, market_name):
except HTTPError as e:
details = "%s" % e
return build_error_response(request, 502, "Unexpected response", details=details)
except (ConnectionError, ConnectTimeout):
except (ConnectionError, Timeout):
return build_error_response(request, 504, "Connection Error")

return HttpResponse(json.dumps(result, sort_keys=True), content_type='application/json; charset=UTF-8')
Expand All @@ -163,7 +163,7 @@ def read(self, request, market_user, market_name):
except HTTPError as e:
details = "%s" % e
return build_error_response(request, 502, "Unexpected response", details=details)
except (ConnectionError, ConnectTimeout):
except (ConnectionError, Timeout):
return build_error_response(request, 504, "Connection Error")

return HttpResponse(json.dumps(result, sort_keys=True), content_type='application/json; chaset=UTF-8')
Expand All @@ -187,7 +187,7 @@ def process(self, request, market_user, market_name, store):
except HTTPError as e:
details = "%s" % e
return build_error_response(request, 502, "Unexpected response", details=details)
except (ConnectionError, ConnectTimeout):
except (ConnectionError, Timeout):
return build_error_response(request, 504, "Connection Error")

return HttpResponse(json.dumps(result, sort_keys=True), content_type='application/json; chaset=UTF-8')

0 comments on commit 00af389

Please sign in to comment.