ProtonVPN / linux-cli

Official ProtonVPN Linux app (CLI)
https://protonvpn.com/download-linux
GNU General Public License v3.0
335 stars 43 forks source link

An error occured while attempting to reach API #10

Open blackPantherOS opened 3 years ago

blackPantherOS commented 3 years ago

Hi,

We got this message after tried login and enter password


Enter your ProtonVPN password: 

An error occured while attempting to reach API

The log

cat protonvpn-cli.log

2021-06-16 22:01:03,580 — cli.py — INFO — __init__:49 — 
-------------------------------------------------

-----------     Initialized protonvpn-cli       -----------

-------------------------------------------------
2021-06-16 22:01:03,580 — cli.py — INFO — __init__:54 — ProtonVPN CLI v3.6.0 (protonvpn-nm-lib v3.2.1; proton-client v0.5.1)
2021-06-16 22:01:03,580 — cli.py — INFO — __init__:57 — CLI command: Namespace(command='login', help=False, version=False)
2021-06-16 22:01:08,328 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login
2021-06-16 22:01:08,350 — cli_wrapper.py — ERROR — login:73 — An error occured while attempting to reach API
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/requests/models.py", line 382, in prepare_url
    scheme, auth, host, port, path, query, fragment = parse_url(url)
  File "/usr/lib/python3.7/site-packages/urllib3/util/url.py", line 392, in parse_url
    return six.raise_from(LocationParseError(source_url), None)
  File "<string>", line 3, in raise_from
urllib3.exceptions.LocationParseError: Failed to parse: https://api.protonvpn.ch/auth/info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/proton/api.py", line 103, in api_request
    timeout=self.__timeout
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 466, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/lib/python3.7/site-packages/requests/models.py", line 316, in prepare
    self.prepare_url(url, params)
  File "/usr/lib/python3.7/site-packages/requests/models.py", line 384, in prepare_url
    raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: https://api.protonvpn.ch/auth/info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/protonvpn_nm_lib/core/session/session.py", line 26, in __call__
    result = self._func(session, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/protonvpn_nm_lib/core/session/session.py", line 294, in authenticate
    self.__proton_api.authenticate(username, password)
  File "/usr/lib/python3.7/site-packages/proton/api.py", line 146, in authenticate
    info_response = self.api_request("/auth/info", payload)
  File "/usr/lib/python3.7/site-packages/proton/api.py", line 112, in api_request
    raise UnknownConnectionError(e)
proton.exceptions.UnknownConnectionError: Failed to parse: https://api.protonvpn.ch/auth/info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/protonvpn_cli/cli_wrapper.py", line 71, in login
    self.protonvpn.login(username, password)
  File "/usr/lib/python3.7/site-packages/protonvpn_nm_lib/api.py", line 28, in login
    self._env.api_session.authenticate(username, password)
  File "/usr/lib/python3.7/site-packages/protonvpn_nm_lib/core/session/session.py", line 44, in __call__
    raise APIError("An error occured while attempting to reach API")
protonvpn_nm_lib.exceptions.APIError: An error occured while attempting to reach API
lenfrost commented 3 years ago

The same here. been like this for about a month now. I've had this issue before with the previous protonvpn command lines. probably has to do with protonvpn being blocked in my country [Iran].

calexandru2018 commented 3 years ago

Hey @blackPantherOS

Can you ping api.protonvpn.ch ? If not then is indeed as @lennyalderson is stating. We're currently working on alternative routing, so this shouldn't be happening once alternative routing is complete.

pmoieni commented 3 years ago

when alternative routing will be available? protonvpn-cli-ng app told me to upgrade to 3.7.1 version of protonvpn-cli and now I can't change from protonvpn.ch to protonmail.ch!

OS: Manjaro Kde ornara 21.0.7

ghonchesefidi commented 2 years ago

I have same problem

pmoieni commented 2 years ago

I have same problem

It's about 3 months I posted my comment and they didn't add the alternative routing. It's available on their mobile app but takes time to migrate it to Linux. At the moment you'd rather use protonvpn-cli-ng from AUR if you are using arch. It's still maintained and works fine. I'm in Iran BTW😁

calexandru2018 commented 2 years ago

Hey @Graham1384 , @ghonchesefidi , @lennyfrost and @blackPantherOS . Alternative routing is now available in early access. If you would like to try it out, select your distro from here and follow the steps to install early access (aka beta) version.

Please provide some feedback here or (preferably) to our support.

Edit: Since it's still in early access, there is no support for arch based systems.

ghonchesefidi commented 2 years ago

@calexandru2018 Thanks for your update. I have followed the link and was able to install the beta version and it's working fine for me now. Appreciate your help.

calexandru2018 commented 2 years ago

Alternative routing has been pushed to stable branch, and that includes AUR. Please provide feedback if alternative routing did work, and if so close this issue.

pmoieni commented 2 years ago

Alternative routing has been pushed to stable branch, and that includes AUR. Please provide feedback if alternative routing did work, and if so close this issue.

thanks, It's working now on Manjaro. really faster than the ng version.

pmoieni commented 2 years ago

I had to test it more precisely. when I try to log in via wifi. I get this message: HTTPSConnectionPool(host='dns11.quad9.net', port=443): Read timed out. (read timeout=3.05)

config says it's enabled:

ProtonVPN User Settings

Default Protocol: OpenVPN (UDP) Kill Switch: Off Netshield: Disabled DNS: Automatic Alternative Routing: Enabled VPN Accelerator: Enabled

as far as I know, the mobile version first will establish a connection to log in user and then receives servers. I'm not a professional programmer but it seems the list of the servers is saved in a file that is accessible offline.

It's not a big deal for me as long as I can log in just one time with mobile data and then everything works.

calexandru2018 commented 2 years ago

@Graham1384 can you reach out to support ?

So login works from mobile data but not wifi ?

pmoieni commented 2 years ago

@Graham1384 can you reach out to support ?

So login works from mobile data but not wifi ?

yes

another alternative routing for login I think.

pmoieni commented 2 years ago

@Graham1384 can you reach out to support ?

So login works from mobile data but not wifi ?

after restarting the laptop the connection itself won't work. it gets stuck here:

image

first I have to connect with mobile data to receive servers then I can connect with wifi

pmoieni commented 2 years ago

@calexandru2018 should I install the community version or a fix will be available soon?

calexandru2018 commented 2 years ago

@Graham1384 please contact support as we need to debug and understand what is happening.

aliazani commented 2 years ago

@Graham1384 @calexandru2018 I have the same problem , I'm running on manjaro I used aur packages, but when I try to login , I encounter an error: HTTPSConnectionPool(host='dns11.quad9.net', port=443): Read timed out. (read timeout=3.05)

I checked the log files: 2021-10-09 15:46:12,931 — cli.py — INFO — init:29 — ProtonVPN CLI v3.9.1 (protonvpn-nm-lib v3.4.1; proton-client v0.6.1) 2021-10-09 15:46:12,933 — cli.py — INFO — init:64 — CLI command: Namespace(command='login', version=False, help=False, get_logs=False) 2021-10-09 15:46:14,479 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2021-10-09 15:46:46,338 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2021-10-09 15:47:14,562 — cli_wrapper.py — ERROR — login:80 — HTTPSConnectionPool(host='dns11.quad9.net', port=443): Read timed out. (read timeout=3.05) Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn conn.connect() File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 411, in connect self.sock = ssl_wrapsocket( File "/usr/lib/python3.9/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "/usr/lib/python3.9/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() socket.timeout: _ssl.c:1112: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/lib/python3.9/site-packages/urllib3/util/retry.py", line 532, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise raise value File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 385, in _make_request self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='dns11.quad9.net', port=443): Read timed out. (read timeout=3.05)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/protonvpn_cli/cli_wrapper.py", line 71, in login self.protonvpn.login(username, password) File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/api.py", line 30, in login self._env.api_session.authenticate(username, password) File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/session/session.py", line 34, in call result = self._func(session, args, kwargs) File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/session/session.py", line 359, in authenticate self.proton_api.authenticate(username, password) File "/usr/lib/python3.9/site-packages/proton/api.py", line 366, in authenticate info_response = self.api_request("/auth/info", payload) File "/usr/lib/python3.9/site-packages/proton/api.py", line 262, in api_request response = self.try_with_alt_routing(fct, request_params) File "/usr/lib/python3.9/site-packages/proton/api.py", line 282, in try_with_alt_routing alternative_routes = self.get_alternative_routes_from_dns() File "/usr/lib/python3.9/site-packages/proton/api.py", line 494, in get_alternative_routes_from_dns dns_hosts_response = list( File "/usr/lib/python3.9/concurrent/futures/_base.py", line 610, in result_iterator yield fs.pop().result(end_time - time.monotonic()) File "/usr/lib/python3.9/concurrent/futures/_base.py", line 445, in result return self.get_result() File "/usr/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result raise self._exception File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(self.args, self.kwargs) File "/usr/lib/python3.9/site-packages/proton/api.py", line 548, in __query_for_dns_data response = requests.get( File "/usr/lib/python3.9/site-packages/requests/api.py", line 75, in get return request('get', url, params=params, kwargs) File "/usr/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='dns11.quad9.net', port=443): Read timed out. (read timeout=3.05) 2021-10-09 15:51:02,767 — cli.py — INFO — init:17 —

my config file is look like: { "default_protocol": "udp", "killswitch": 0, "dns": { "dns_status": 2, "custom_dns": [ "1.1.1.1" ] }, "split_tunneling": { "split_tunneling_status": 0, "ip_list": [] }, "netshield": 0, "secure_core": 0, "vpn_accelerator": 1, "alternative_routing": 1 }

I'm not sure 100 percent but I think there's something wrong with alternative routes after I'd tried to to turn off alternative_routing , I encountered this error: Unable to reach API

I changed the default dns to 1.1.1.1/ 8.8.8.8 but still not working!

I can confidently ping dns11.quad9.net and that's working . I tried to test the dns11.quad9.net with https commmand line tool for dns11.quad9.net: With out vpn connection that wasn't reachable after setup vpn connection with legacy protonvpn that was perfectly fine and that was reachable.

I think the problem is dns11.quad9.net. Hope that receive fixed version soon.

calexandru2018 commented 2 years ago

@aliazani try enable dns to automatic and enable alt routing

aliazani commented 2 years ago

@calexandru2018 I did that too but not still not working! I got HTTPSConnectionPool(host='dns11.quad9.net', port=443): Read timed out. (read timeout=3.05)

calexandru2018 commented 2 years ago

@aliazani please reach out to support

pmoieni commented 2 years ago

@calexandru2018 when I was using protonvpn-cli-ng package I always had to change its python code before logging in. I always change "protonvpn.ch" to "protonmail.ch". can it be related to this issue? because in my country protonvpn.ch is blocked and only protonmail.ch works.

pmoieni commented 2 years ago

@calexandru2018 @aliazani

I think I've found a workaround by accident

  1. first change dns to 1.1.1.1
  2. then connect to mobile hotspot. (one that can ping protonvpn.ch)
  3. now login to your account using cli
  4. then connect to any network you want and connect to VPN

It worked for me. try it out!

calexandru2018 commented 2 years ago

@Graham1384 with alt routing this shouldn't be necessary. If alt routing is not working for you, please reach out to customer support so we can gather more info and make sure that alternative routing is working for you (and others that are in a similar situation)

pmoieni commented 2 years ago

@calexandru2018 I sent a post to support an hour ago. waiting for the answer.

pmoieni commented 2 years ago

@calexandru2018 @aliazani

I think I've found a workaround by accident

1. first change dns to 1.1.1.1

2. then connect to mobile hotspot. (one that can ping protonvpn.ch)

3. now login to your account using cli

4. then connect to any network you want and connect to VPN

It worked for me. try it out!

seems this is not permanent. after some specific amount of time, it gets stuck on the blue screen.

when I try using the fastest server it works. protonvpn-cli c -f

but choosing server from menu gets stuck on the blue screen.

aliazani commented 2 years ago

I sent a ticket to support and hope that they find a solution

calexandru2018 commented 2 years ago

Hey @aliazani and @Graham1384 , the situation was identified and a patch will be pushed next beta release. The issue was that the exception was not being catched, thus not allowing to loop through the available DNSs.

Make sure you have the beta version installed to receive the latest versions and test it out.

pmoieni commented 2 years ago

Hey @aliazani and @Graham1384 , the situation was identified and a patch will be pushed next beta release. The issue was that the exception was not being catched, thus not allowing to loop through the available DNSs.

Make sure you have the beta version installed to receive the latest versions and test it out.

I contacted support and all they said was that your ISP is blocking our servers and in your country you can't use linux cli because we use some packages that won't let us implement alternative routing as it is on windows and mobile app. I hope it'll work. To be honest Linux really doesn't work without a good VPN.

aliazani commented 2 years ago

@calexandru2018 Great, let us know when it was available.

calexandru2018 commented 2 years ago

@aliazani @Graham1384 this has been addressed with the newest version. Indeed a check was not being made for the next in the list DNS to a exception not being handled. This has been now addressed. Please confirm that this solution is working for you.

If both of the dns hosts are blocked there is no way to circumvent it. Here you can find a list of them: https://github.com/ProtonMail/proton-python-client/blob/master/proton/constants.py#L24 (but hopefully you will do to our implementation of encoded urls)

aliazani commented 2 years ago

@calexandru2018 Portonvpn-cli log:


2021-10-25 14:45:55,498 — cli.py — INFO — init:64 — CLI command: Namespace(command='login', version=False, help=False, get_logs=False) 2021-10-25 14:45:58,879 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2021-10-25 14:46:30,216 — cli_wrapper.py — ERROR — login:117 — Network error Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/protonvpn_cli/cli_wrapper.py", line 73, in login self.protonvpn.login(username, password) File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/api.py", line 31, in login self._env.api_session.authenticate(username, password, human_verification) File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/session/session.py", line 39, in call result = self._func(session, *args, kwargs) File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/session/session.py", line 382, in authenticate self.proton_api.authenticate(username, password) File "/usr/lib/python3.9/site-packages/proton/api.py", line 387, in authenticate info_response = self.api_request("/auth/info", payload) File "/usr/lib/python3.9/site-packages/proton/api.py", line 261, in api_request response = self.try_with_alt_routing(fct, request_params) File "/usr/lib/python3.9/site-packages/proton/api.py", line 327, in __try_with_alt_routing raise NetworkError("Network error") proton.exceptions.NetworkError: Network error

calexandru2018 commented 2 years ago

Ok from that it seems that both dns hosts are blocked. Could you test the following and see if you can reach them:

aliazani commented 2 years ago

@calexandru2018 yes, they are working perfectly with icmp but with http there is no response back!

ping dns11.quad9.net PING dns11.quad9.net (149.112.112.11) 56(84) bytes of data. 64 bytes from dns11.quad9.net (149.112.112.11): icmp_seq=1 ttl=54 time=73.3 ms 64 bytes from dns11.quad9.net (149.112.112.11): icmp_seq=2 ttl=54 time=70.2 ms

ping dns.google PING dns.google (8.8.4.4) 56(84) bytes of data. 64 bytes from dns.google (8.8.4.4): icmp_seq=1 ttl=109 time=77.7 ms 64 bytes from dns.google (8.8.4.4): icmp_seq=2 ttl=109 time=75.1 ms

without vpn connection can't reach https://dns.google/dns-query, https://dns11.quad9.net/dns-query

calexandru2018 commented 2 years ago

yes, they are working perfectly with icmp but with http there is no response back!

That is interesting, could you try also for these:

aliazani commented 2 years ago
  • 9.9.9.11

I can ping all of them without problem but can't reach any of them via http protocol.

calexandru2018 commented 2 years ago
  • 9.9.9.11

I can ping all of them without problem but can't reach any of them via http protocol.

Ok so that explains it. This is the current alternative routing implementation that we have on all our clients (using the previously shared dns hosts). I'll discuss this internally with our team, thank you for the feedback.

aliazani commented 2 years ago
  • 9.9.9.11

I can ping all of them without problem but can't reach any of them via http protocol.

Ok so that explains it. This is the current alternative routing implementation that we have on all our clients (using the previously shared dns hosts). I'll discuss this internally with our team, thank you for the feedback.

I can reach http://208.67.222.222/ http://208.67.220.220/ http://76.76.19.19/ http://76.223.122.150/ 91.239.100.100

Yugeniki commented 2 years ago

For whatever it is worth, two months later the issue persists still, for me at least. Can't log into protonvpn, but in my case the issue is "unknown error occured". My country is the same as others here, Iran. So it is probably being blocked yet again.

pmoieni commented 2 years ago

For whatever it is worth, two months later the issue persists still, for me at least. Can't log into protonvpn, but in my case the issue is "unknown error occured". My country is the same as others here, Iran. So it is probably being blocked yet again.

It's the same for everyone here. seems they need to change something on the server side. for now there's no chance for it to get fixed. BTW this command works at least:

protonvpn-cli c -f

It takes about 30 seconds to find the fastest server and connect but after establishing connection you can run "protonvpn-cli c" again to connect to your prefered server.

programming without a VPN is such a mess.😔

aliazani commented 2 years ago

@calexandru2018 After long period of time, I've tested official version again but now I'm facing Network error with alternate routing enable like below:

2022-06-04 08:17:28,967 — cli.py — INFO — init:29 — Proton VPN CLI v3.12.0 (protonvpn-nm-lib v3.10.0; proton-client v0.7.1) 2022-06-04 08:17:28,969 — cli.py — INFO — init:64 — CLI command: Namespace(command='login', version=False, help=False, get_logs=False) 2022-06-04 08:17:33,671 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2022-06-04 08:18:37,365 — cli_wrapper.py — ERROR — login:117 — Network error Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/protonvpn_cli/cli_wrapper.py", line 73, in login self.protonvpn.login(username, password) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/api.py", line 36, in login self._env.api_session.authenticate(username, password, human_verification) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 39, in call result = self._func(session, *args, kwargs) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 390, in authenticate self.proton_api.authenticate(username, password) File "/usr/lib/python3.10/site-packages/proton/api.py", line 387, in authenticate info_response = self.api_request("/auth/info", payload) File "/usr/lib/python3.10/site-packages/proton/api.py", line 261, in api_request response = self.try_with_alt_routing(fct, request_params) File "/usr/lib/python3.10/site-packages/proton/api.py", line 327, in __try_with_alt_routing raise NetworkError("Network error") proton.exceptions.NetworkError: Network error

And without alternate routing I face Unable to reach API like below:

2022-06-04 08:15:38,701 — cli.py — INFO — init:29 — Proton VPN CLI v3.12.0 (protonvpn-nm-lib v3.10.0; proton-client v0.7.1) 2022-06-04 08:15:38,702 — cli.py — INFO — init:64 — CLI command: Namespace(command='login', version=False, help=False, get_logs=False) 2022-06-04 08:15:39,798 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2022-06-04 08:16:08,975 — cli_wrapper.py — ERROR — login:93 — Unable to reach API Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 39, in call result = self._func(session, *args, **kwargs) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 390, in authenticate self.__proton_api.authenticate(username, password) File "/usr/lib/python3.10/site-packages/proton/api.py", line 387, in authenticate info_response = self.api_request("/auth/info", payload) File "/usr/lib/python3.10/site-packages/proton/api.py", line 256, in api_request raise exception_class(exception_msg) proton.exceptions.NewConnectionError: TLSPinningHTTPSConnectionPool(host='api.protonvpn.ch', port=443): Max retries exceeded with url: /auth/info (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc911e0ded0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/protonvpn_cli/cli_wrapper.py", line 73, in login self.protonvpn.login(username, password) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/api.py", line 36, in login self._env.api_session.authenticate(username, password, human_verification) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 48, in call raise UnreacheableAPIError("Unable to reach API") protonvpn_nm_lib.exceptions.UnreacheableAPIError: Unable to reach API 2022-06-04 08:17:25,283 — cli.py — INFO — init:17 —

aliazani commented 2 years ago

@calexandru2018 After long period of time, I've tested official version again but now I'm facing Network error with alternate routing enable like below:

2022-06-04 08:17:28,967 — cli.py — INFO — init:29 — Proton VPN CLI v3.12.0 (protonvpn-nm-lib v3.10.0; proton-client v0.7.1) 2022-06-04 08:17:28,969 — cli.py — INFO — init:64 — CLI command: Namespace(command='login', version=False, help=False, get_logs=False) 2022-06-04 08:17:33,671 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2022-06-04 08:18:37,365 — cli_wrapper.py — ERROR — login:117 — Network error Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/protonvpn_cli/cli_wrapper.py", line 73, in login self.protonvpn.login(username, password) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/api.py", line 36, in login self._env.api_session.authenticate(username, password, human_verification) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 39, in call result = self._func(session, *args, kwargs) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 390, in authenticate self.proton_api.authenticate(username, password) File "/usr/lib/python3.10/site-packages/proton/api.py", line 387, in authenticate info_response = self.api_request("/auth/info", payload) File "/usr/lib/python3.10/site-packages/proton/api.py", line 261, in api_request response = self.try_with_alt_routing(fct, request_params) File "/usr/lib/python3.10/site-packages/proton/api.py", line 327, in __try_with_alt_routing raise NetworkError("Network error") proton.exceptions.NetworkError: Network error

And without alternate routing I face Unable to reach API like below:

2022-06-04 08:15:38,701 — cli.py — INFO — init:29 — Proton VPN CLI v3.12.0 (protonvpn-nm-lib v3.10.0; proton-client v0.7.1) 2022-06-04 08:15:38,702 — cli.py — INFO — init:64 — CLI command: Namespace(command='login', version=False, help=False, get_logs=False) 2022-06-04 08:15:39,798 — cli_wrapper.py — INFO — login:68 — Credentials provided, attempting to login 2022-06-04 08:16:08,975 — cli_wrapper.py — ERROR — login:93 — Unable to reach API Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 39, in call result = self._func(session, *args, kwargs) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 390, in authenticate self.__proton_api.authenticate(username, password) File "/usr/lib/python3.10/site-packages/proton/api.py", line 387, in authenticate info_response = self.api_request("/auth/info", payload) File "/usr/lib/python3.10/site-packages/proton/api.py", line 256, in api_request raise exception_class(exception_msg) proton.exceptions.NewConnectionError: TLSPinningHTTPSConnectionPool(host='api.protonvpn.ch', port=443): Max retries exceeded with url: /auth/info (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc911e0ded0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/protonvpn_cli/cli_wrapper.py", line 73, in login self.protonvpn.login(username, password) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/api.py", line 36, in login self._env.api_session.authenticate(username, password, human_verification) File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/session/session.py", line 48, in call raise UnreacheableAPIError("Unable to reach API") protonvpn_nm_lib.exceptions.UnreacheableAPIError: Unable to reach API 2022-06-04 08:17:25,283 — cli.py — INFO — init**:17 —

I consider all related to reaching api becuase log file of proton-client.log is like below:

2022-06-04 08:24:26,280 — api.py — ERROR — api_request:246 — TLSPinningHTTPSConnectionPool(host='api.protonvpn.ch', port=443): Max retries exceeded with url: /auth/info (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0b3507de70>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/usr/lib/python3.10/site-packages/urllib3/util/connection.py", line 72, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/usr/lib/python3.10/socket.py", line 955, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/usr/lib/python3.10/site-packages/proton/cert_pinning.py", line 90, in _validate_conn super(TLSPinningHTTPSConnectionPool, self)._validate_conn(conn) File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn conn.connect() File "/usr/lib/python3.10/site-packages/urllib3/connection.py", line 358, in connect self.sock = conn = self._new_conn() File "/usr/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f0b3507de70>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

I'm wondering why can't change api.protonmail.ch to solve the problem!

NikMAX2077 commented 1 year ago

Same here in 2023