Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def display_servers(list_servers: List, port: str, area: str, p2p: bool, dedicated: bool, double_vpn: bool,
tor_over_vpn: bool, anti_ddos: bool, netflix: bool, location: float) -> None:
servers_on_web = set() # servers shown on the website
# if list_servers was not a specific country it would be "all"
json_res_list = api.get_data_from_api(
country_code=list_servers, area=area, p2p=p2p, dedicated=dedicated,
double_vpn=double_vpn, tor_over_vpn=tor_over_vpn, anti_ddos=anti_ddos,
netflix=netflix, location=location)
# logger.debug(json_res_list)
print(Style.BRIGHT + Fore.BLUE + "The NordVPN Servers In", Fore.GREEN +
list_servers.upper() + Fore.BLUE, end=" ")
if area:
print("Area ", Fore.GREEN + area + Fore.BLUE, end=" ")
if p2p:
print("with " + Fore.GREEN + "p2p" + Fore.BLUE + " support", end=" ")
if dedicated:
print("with " + Fore.GREEN + "dedicated" + Fore.BLUE + " support", end=" ")
if double_vpn:
print("with " + Fore.GREEN + "double_vpn" + Fore.BLUE + " support", end=" ")
if tor_over_vpn:
def find_better_servers(country_code: str, area: str, max_load: int, top_servers: int, tcp: bool,
p2p: bool, dedicated: bool, double_vpn: bool, tor_over_vpn: bool,
anti_ddos: bool, netflix: bool, location: float, stats: bool) -> List:
if tcp:
used_protocol = "OPENVPN-TCP"
else:
used_protocol = "OPENVPN-UDP"
# use api.nordvpn.com
json_res_list = api.get_data_from_api(
country_code=country_code, area=area, p2p=p2p, dedicated=dedicated,
double_vpn=double_vpn, tor_over_vpn=tor_over_vpn, anti_ddos=anti_ddos,
netflix=netflix, location=location)
server_list = filters.filter_by_protocol(json_res_list=json_res_list, tcp=tcp)
better_servers_list = filters.filter_by_load(server_list, max_load, top_servers)
if stats:
print(Style.BRIGHT + Fore.BLUE + "According to NordVPN, \
Least Busy " + Fore.GREEN + str(len(better_servers_list)) + Fore.BLUE + " Servers in \
" + Fore.GREEN + country_code.upper() + Fore.BLUE, end=" ")
if area:
print("in Location" + Fore.GREEN, json_res_list[0]["location_names"], end=" ")
print(Fore.BLUE + "With 'Load' Less Than", Fore.GREEN + str(max_load) + Fore.BLUE,