Improved HTTP error handling in test_api.py so that requests are retried (with a time delay) a preset number of times before finally failing.  The HTML message bodies of HTTP error responses can also be saved to the output file.