summaryrefslogtreecommitdiff
path: root/wrappers/python/main.py
blob: 1c1afd71893a20f6d50f688b9c59821c2f7e0a2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import eduvpncommon.main as eduvpn
import webbrowser


_eduvpn = eduvpn.EduVPN("org.eduvpn.app.linux", "configs")


@_eduvpn.event.on("OAuth_Started", eduvpn.StateType.Enter)
def oauth_initialized(url):
    print(f"Got OAUTH url {url}")
    webbrowser.open(url)


@_eduvpn.event.on("Ask_Profile", eduvpn.StateType.Enter)
def ask_profile(profiles):
    print("ASK PROFILE CB", profiles)
    _eduvpn.set_profile("prefer-openvpn")


success = _eduvpn.register(debug=True)

if not success:
    print("failed to register")

print(_eduvpn.get_disco())

config, error = _eduvpn.get_config_institute_access("https://eduvpn.jwijenbergh.com")

if error:
    print("Got connect error", error)

print(config)