Use proper timeouts for requests + better error handling

Default behaviour apparently is blocking, we never want that!

Also make error responses actually raise an exception.
This commit is contained in:
Gina Häußge committed 2017-04-12 13:50:52 +02:00
1 parent 9bcce4e56a
commit bba9d6cc18
6 files changed
+11 -8

No files matched your search

@@ -15,7 +15,7 @@ BRANCH_HEAD_URL = "https://api.github.com/repos/{user}/{repo}/git/refs/heads/{br
logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.github_commit")
def _get_latest_commit(user, repo, branch):
r = requests.get(BRANCH_HEAD_URL.format(user=user, repo=repo, branch=branch))
r = requests.get(BRANCH_HEAD_URL.format(user=user, repo=repo, branch=branch), timeout=30)
from . import log_github_ratelimit
log_github_ratelimit(logger, r)