Sfoglia il codice sorgente

Retry failing zKillboard queries once.

master
Ben Kurtovic 8 anni fa
parent
commit
fccc9c33d7
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. +6
    -1
      calefaction/eve/zkill.py

+ 6
- 1
calefaction/eve/zkill.py Vedi File

@@ -32,7 +32,12 @@ class ZKillboard:
self._debug("[GET] %s", query)

try:
resp = self._session.get(url, timeout=10)
try:
resp = self._session.get(url, timeout=10)
except requests.ConnectionError:
self._logger.warn("zKillboard API query failed, retrying once")
time.sleep(self._MAX_RATE)
resp = self._session.get(url, timeout=10)
resp.raise_for_status()
result = resp.json() if resp.content else None
except (requests.RequestException, ValueError):


Caricamento…
Annulla
Salva