hedyhli / starcli

:sparkles: Browse trending GitHub projects from your command line
https://pypi.org/project/starcli/
MIT License
547 stars 50 forks source link

Moves retry logic into search.get_valid_request #79

Closed jSadoski closed 4 years ago

jSadoski commented 4 years ago

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.