|
|
@ -5,7 +5,12 @@ from typing import Optional, Tuple |
|
|
|
|
|
|
|
|
|
|
|
TIME_BEFORE_RETRY = 2.0 |
|
|
|
logger = logging.Logger("client") |
|
|
|
logging.basicConfig(level=logging.INFO) |
|
|
|
logger = logging.getLogger("client") |
|
|
|
|
|
|
|
|
|
|
|
def set_log_level(log_level: str): |
|
|
|
logger.setLevel(log_level) |
|
|
|
|
|
|
|
|
|
|
|
def get_state(min_round: int, args) -> Tuple[Optional[dict], float]: |
|
|
@ -19,7 +24,7 @@ def get_state(min_round: int, args) -> Tuple[Optional[dict], float]: |
|
|
|
}) |
|
|
|
# retry later if there was an error |
|
|
|
except requests.exceptions.RequestException as e: |
|
|
|
logger.warning("Request error: {e}") |
|
|
|
logger.warning(f"Request error: {e}") |
|
|
|
return None, TIME_BEFORE_RETRY |
|
|
|
if not r.ok: |
|
|
|
logger.warning(f"Server error: {r.status_code} {r.reason}") |
|
|
|