Commits

Jason R. Coombs  committed 130b68e

Save the HTTP body when there's an HTTP error

  • Participants
  • Parent commits 814eb3b

Comments (0)

Files changed (1)

File jaraco/financial/ofx.py

 	"""
 	Context wrapper around urlopen
 	"""
-	response = urllib2.urlopen(*args, **kwargs)
+	try:
+		response = urllib2.urlopen(*args, **kwargs)
+	except urllib2.HTTPError as err:
+		with open('err.txt', 'wb') as err_f:
+			err_f.write(err.read())
+		raise
 	try:
 		yield response
 	finally: