Move HTTPError handling to search.get_valid_request
Context
Currently, main is handling an HTTPError and using that to execute the strategy to poll the API again. This is an issue because it means the behavior of search can't reliably return the same result when the result isn't 200/202 - unless we want to build exception handling and retry code inside of test_search.py, which doesn't seem DRY and could cause issues later if we need to change the request.status_code strategy.
Description
This way, get_valid_request does something closer to what the function name suggests. It also means we don't need to import requests libraries into main.
Move HTTPError handling to search.get_valid_request
Context
Currently, main is handling an HTTPError and using that to execute the strategy to poll the API again. This is an issue because it means the behavior of search can't reliably return the same result when the result isn't 200/202 - unless we want to build exception handling and retry code inside of test_search.py, which doesn't seem DRY and could cause issues later if we need to change the request.status_code strategy.
Description
This way, get_valid_request does something closer to what the function name suggests. It also means we don't need to import requests libraries into main.