How to use the openpyn.locations.get_unique_locations function in openpyn

To help you get started, we’ve selected a few openpyn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jotyGill / openpyn-nordvpn / openpyn / openpyn.py View on Github external
if tor_over_vpn:
        print("with " + Fore.GREEN + "tor_over_vpn" + Fore.BLUE + " support", end=" ")
    if anti_ddos:
        print("with " + Fore.GREEN + "anti_ddos" + Fore.BLUE + " support", end=" ")
    if netflix:
        print("with " + Fore.GREEN + "netflix" + Fore.BLUE + " support", end=" ")
    print("Are:\n" + Style.RESET_ALL)

    # add server names to "servers_on_web" set
    for res in json_res_list:
        print("Server =", res["domain"][:res["domain"].find(".")], ", Load =", res["load"],
              ", Country =", res["country"], ", Features", res["categories"], "\n")
        servers_on_web.add(res["domain"][:res["domain"].find(".")])

    if not area:
        locations_in_country = locations.get_unique_locations(list_of_servers=json_res_list)
        print("The available Locations in country", list_servers.upper(), "are :")
        for eachLocation in locations_in_country:
            print(eachLocation[2])
        print("")

    if list_servers != "all" and not p2p and not dedicated and not double_vpn \
            and not tor_over_vpn and not anti_ddos and not netflix and not area:
            # else not applicable.
        print_latest_servers(list_servers=list_servers, port=port, server_set=servers_on_web)
github jotyGill / openpyn-nordvpn / openpyn / filters.py View on Github external
def filter_by_area(area: str, type_country_filtered: List) -> List:
    remaining_servers = []
    resolved_locations = locations.get_unique_locations(list_of_servers=type_country_filtered)
    for aServer in type_country_filtered:
        for item in resolved_locations:
            lower_case_areas = [x.lower() for x in item[2]]
            if aServer["location"]["lat"] == item[1]["lat"] and \
                    aServer["location"]["long"] == item[1]["long"] and \
                    area.lower() in lower_case_areas:
                aServer["location_names"] = item[2]  # add location info to server
                # logger.debug(aServer)
                remaining_servers.append(aServer)
    return remaining_servers