1. rg3
  2. youtube-dl

Commits

rg3  committed 967a25f

Retry on any 5xx server error

  • Participants
  • Parent commits acc60b2
  • Branches default

Comments (0)

Files changed (1)

File youtube-dl

View file
 				data = urllib2.urlopen(request)
 				break
 			except (urllib2.HTTPError, ), err:
-				if err.code != 500 and err.code != 503 and err.code != 416:
+				if (err.code < 500 or err.code >= 600) and err.code != 416:
 					# Unexpected HTTP error
 					raise
 				elif err.code == 416:
 						data = urllib2.urlopen(basic_request)
 						content_length = data.info()['Content-Length']
 					except (urllib2.HTTPError, ), err:
-						if err.code != 503 and err.code != 500:
+						if err.code < 500 or err.code >= 600:
 							raise
 					else:
 						# Examine the reported length