Skip to content

Instantly share code, notes, and snippets.

@SamsungGalaxyPlayer
Created July 25, 2023 19:45
Show Gist options
  • Select an option

  • Save SamsungGalaxyPlayer/9fe423c693ab534e9e458ca108e5938d to your computer and use it in GitHub Desktop.

Select an option

Save SamsungGalaxyPlayer/9fe423c693ab534e9e458ca108e5938d to your computer and use it in GitHub Desktop.
Get all Proton VPN IP addresses and export them into a CSV file
import requests
import csv
response_data = requests.get('https://api.protonmail.ch/vpn/logicals')
response_json = response_data.json()
ip_list = []
for server in response_json['LogicalServers']:
for server_info in server['Servers']:
exit_ip = server_info['ExitIP']
ip_list.append(exit_ip)
with open('protonvpn_exit_ips.csv', mode='w', newline='') as file:
writer = csv.writer(file)
writer.writerows(zip(ip_list))
num_ips = len(ip_list)
print(f"{num_ips} exit IPs exported to protonvpn_exit_ips.csv")
@xabixab
Copy link

xabixab commented Nov 24, 2024

Hi @rozhasi, look at the JSON response structure. It seems you just have to replace "ExitIP" with "EntryIP".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment