From 058dca45d3c818212eb2ceb2156cd9ab39777dba Mon Sep 17 00:00:00 2001 From: Lewis England Date: Fri, 24 May 2024 13:48:56 +0100 Subject: [PATCH] feat: add endpoint for getting the Proxy settings relates-to: #69 --- src/boinc_client/boinc_client.py | 4 ++++ src/boinc_client/messages.py | 1 + src/boinc_client/preferences.py | 2 +- tests/integration/test_boinc_client.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/boinc_client/boinc_client.py b/src/boinc_client/boinc_client.py index ba7f523..e8b70c3 100644 --- a/src/boinc_client/boinc_client.py +++ b/src/boinc_client/boinc_client.py @@ -2,6 +2,7 @@ from .messages import get_all_notices, message_count, messages, public_notices from .modes import set_cpu_run_mode, set_gpu_run_mode, set_network_mode +from .network import get_proxy_settings from .preferences import ( get_global_prefs_file, get_global_prefs_override, @@ -177,3 +178,6 @@ def set_gpu_run_mode(self, run_mode: str, duration: int = 0) -> dict: def set_network_mode(self, run_mode: str, duration: int = 0) -> dict: return set_network_mode(self.rpc_client, run_mode, duration) + + def get_proxy_settings(self) -> dict: + return get_proxy_settings(self.rpc_client) diff --git a/src/boinc_client/messages.py b/src/boinc_client/messages.py index 5d56aa2..89c51fb 100644 --- a/src/boinc_client/messages.py +++ b/src/boinc_client/messages.py @@ -1,6 +1,7 @@ import logging import xmltodict + from boinc_client.clients.rpc_client import RpcClient from boinc_client.models.message_count import MessageCount from boinc_client.models.messages import Messages diff --git a/src/boinc_client/preferences.py b/src/boinc_client/preferences.py index 00c72ce..2ab10ae 100644 --- a/src/boinc_client/preferences.py +++ b/src/boinc_client/preferences.py @@ -9,7 +9,7 @@ from boinc_client.models.global_preferences import GlobalPreferences logger = logging.getLogger(__name__) -logging.basicConfig(filename='boinc_client.log', encoding='utf-8', level=logging.DEBUG) +logging.basicConfig(filename="boinc_client.log", encoding="utf-8", level=logging.DEBUG) def get_global_prefs_file(client: RpcClient) -> dict: diff --git a/tests/integration/test_boinc_client.py b/tests/integration/test_boinc_client.py index 825a6fa..f55ea84 100644 --- a/tests/integration/test_boinc_client.py +++ b/tests/integration/test_boinc_client.py @@ -280,7 +280,7 @@ def test_can_sequentially_set_global_overrides(boinc_test_client, project_weak_k @mark.authenticated -def test_can_set_compute_modes(boinc_test_client, project_weak_key): +def test_can_set_compute_modes(boinc_test_client): assert boinc_test_client.set_cpu_run_mode("always", 60) == {"success": True} assert boinc_test_client.set_gpu_run_mode("auto", 0) == {"success": True} assert boinc_test_client.set_network_mode("never") == {"success": True}