1

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.

1 Answers1

1

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)
Mikhail S
  • 133
  • 1
  • 7