Write script for protonvpn

This commit is contained in:
flyingscorpio@arch-desktop 2020-04-21 09:10:55 +02:00
parent 3e99fd1a35
commit ef00681a4d

14
dotfiles/i3/scripts/protonvpn Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/python3
from protonvpn_cli import utils as pvpn_utils
ip_addr = pvpn_utils.get_ip_info()[0]
connected_server = pvpn_utils.get_config_value("metadata", "connected_server")
servers = pvpn_utils.get_servers()
country_code = pvpn_utils.get_server_value(connected_server, "ExitCountry", servers)
country = pvpn_utils.get_country_name(country_code)
city = pvpn_utils.get_server_value(connected_server, "City", servers)
print("{} ({}) - {}, {}".format(ip_addr, connected_server, country, city))