Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Retries the request 3 times and return None if failed

  • Loading branch information...
commit 5eddd5eb5b5fd206ec3d6c67c5f048b93904bcdc 1 parent 686e547
@georges-gouriten authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 main.py
View
16 main.py
@@ -81,7 +81,21 @@ def blend(self):
if not self.interaction:
print('ERROR blending: no interaction loaded.')
return None
- content, headers = self.make_request()
+ #Retries three times
+ request_not_made = True
+ i = 0
+ while request_not_made and i<3:
+ try:
+ content, headers = self.make_request()
+ request_not_made = False
+ except Exception:
+ i+=1
+ if request_not_made:
+ print "ERROR: Could not make request"
+ print "Server: %s Interaction: %s Parameters: %s" %\
+ ( self.server.name, self.interaction.name,\
+ self.interaction.request.url_params )
+ return None
self.check_response(headers['status'])
prepared_content = self.prepare_content(content)
data = { "raw_content": content,
Please sign in to comment.
Something went wrong with that request. Please try again.