diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-26 17:36:30 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-27 10:53:37 +0200 |
| commit | 09ec69dfdef409868f1cb39cb8cc4b33c8690c9f (patch) | |
| tree | 109925dbbee4a9120211897582760f96010ae8f2 /wrappers/python/eduvpn_common/discovery.py | |
| parent | 0a19c2dedcaaa177b420eac99149515d84508204 (diff) | |
Python: Reformat and move most loading out of __init__
Diffstat (limited to 'wrappers/python/eduvpn_common/discovery.py')
| -rw-r--r-- | wrappers/python/eduvpn_common/discovery.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/wrappers/python/eduvpn_common/discovery.py b/wrappers/python/eduvpn_common/discovery.py index 68741bc..3a1cbe6 100644 --- a/wrappers/python/eduvpn_common/discovery.py +++ b/wrappers/python/eduvpn_common/discovery.py @@ -1,4 +1,8 @@ -from eduvpn_common import lib, cDiscoveryOrganizations, cDiscoveryServers, get_ptr_list_strings +from eduvpn_common.types import ( + cDiscoveryOrganizations, + cDiscoveryServers, + get_ptr_list_strings, +) from ctypes import cast, POINTER @@ -62,7 +66,7 @@ def get_disco_organization(ptr): return DiscoOrganization(display_name, org_id, secure_internet_home, keyword_list) -def get_disco_server(ptr): +def get_disco_server(lib, ptr): if not ptr: return None @@ -75,11 +79,11 @@ def get_disco_server(ptr): display_name = current_server.display_name.decode("utf-8") keyword_list = current_server.keyword_list.decode("utf-8") public_keys = get_ptr_list_strings( - current_server.public_key_list, current_server.total_public_keys + lib, current_server.public_key_list, current_server.total_public_keys ) server_type = current_server.server_type.decode("utf-8") support_contacts = get_ptr_list_strings( - current_server.support_contact, current_server.total_support_contact + lib, current_server.support_contact, current_server.total_support_contact ) return DiscoServer( authentication_url_template, @@ -93,7 +97,7 @@ def get_disco_server(ptr): ) -def get_disco_servers(ptr): +def get_disco_servers(lib, ptr): if ptr: svrs = cast(ptr, POINTER(cDiscoveryServers)).contents @@ -101,7 +105,7 @@ def get_disco_servers(ptr): if svrs.servers: for i in range(svrs.total_servers): - current = get_disco_server(svrs.servers[i]) + current = get_disco_server(lib, svrs.servers[i]) if current is None: continue @@ -111,7 +115,7 @@ def get_disco_servers(ptr): return None -def get_disco_organizations(ptr): +def get_disco_organizations(lib, ptr): if ptr: orgs = cast(ptr, POINTER(cDiscoveryOrganizations)).contents organizations = [] |
