Created
July 25, 2023 19:45
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @rozhasi, look at the JSON response structure. It seems you just have to replace "ExitIP" with "EntryIP".