jotyGill / openpyn-nordvpn

Easily connect to and switch between, OpenVPN servers hosted by NordVPN on Linux (+patch leakes)
GNU General Public License v3.0
628 stars 114 forks source link

KeyError: 'country' when using --area #274

Open norey opened 4 years ago

norey commented 4 years ago

This problem just occurred recently (I saw it happen yesterday), I'm not sure if NordVPN changed something on their end.

$ /usr/local/bin/openpyn us --area Texas
Traceback (most recent call last):
  File "/usr/local/bin/openpyn", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/openpyn/openpyn.py", line 144, in main
    args.skip_dns_patch, args.silent, args.nvram, args.openvpn_options, args.location)
  File "/usr/local/lib/python3.6/dist-packages/openpyn/openpyn.py", line 395, in run
    dedicated, double_vpn, tor_over_vpn, anti_ddos, netflix, location, stats)
  File "/usr/local/lib/python3.6/dist-packages/openpyn/openpyn.py", line 473, in find_better_servers
    netflix=netflix, location=location)
  File "/usr/local/lib/python3.6/dist-packages/openpyn/api.py", line 49, in get_data_from_api
    type_country_area_filtered = filters.filter_by_area(area, type_country_filtered)
  File "/usr/local/lib/python3.6/dist-packages/openpyn/filters.py", line 16, in filter_by_area
    resolved_locations = locations.get_unique_locations(list_of_servers=type_country_filtered)
  File "/usr/local/lib/python3.6/dist-packages/openpyn/locations.py", line 35, in get_unique_locations
    geo_address_list = get_locations(eachLocation, user_agent)
  File "/usr/local/lib/python3.6/dist-packages/openpyn/locations.py", line 71, in get_locations
    geo_address_list.insert(0, results["country"])
KeyError: 'country'
1951FDG commented 3 years ago

This is probably related to https://github.com/jotyGill/openpyn-nordvpn/issues/281

1951FDG commented 3 years ago

Please update to at least openpyn 3.0.0!