Reputation: 132
Is there any libraries for python that can be use for connecting to OpenVPN service using .ovpn configuration file?
The openvpn-api library needs OpenVPN installed on your system.
Upvotes: 1
Views: 4298
Reputation: 188
Good news - you don't need any external libs to connect openvpn. You may just run cmd command from python script like this:
# write the command to a variable
cmd = 'start /b cmd /c "C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect config.ovpn'
# split the command to parameters (It's not a necessity, it's just a rule of good taste)
args = shlex.split(cmd)
# run and remember the process as 'x'
x = subprocess.Popen(args, shell=True)
Upvotes: 1