seanbreckenridge / keepassxc-pwned

Check your keepassxc database against previously breached haveibeenpwned passwords
https://pypi.org/project/keepassxc-pwned/
MIT License
35 stars 4 forks source link

uncaught request error, api.pwnedpassword.com not being resolved #8

Closed seanbreckenridge closed 4 years ago

seanbreckenridge commented 4 years ago

requests may report errors, see discussion in #5

But at first it had some errors about api.pwnedpasswords.com not being resolved.

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.9/socket.py", line 953, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    httplib_response = self._make_request(conn, method, url,
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 344, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 843, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 316, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 168, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7fc2dc3ae460>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 640, in urlopen
    retries = retries.increment(method, url, error=e, _pool=self,
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.pwnedpasswords.com', port=443): Max retries exceeded with url: /range/385D0 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fc2dc3ae460>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/keepassxc_pwned", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/keepassxc_pwned/keepassxc_pwned.py", line 197, in main
    sha1, count = lookup_pwned(c.password, logger)
  File "/usr/local/lib/python3.9/site-packages/keepassxc_pwned/password.py", line 40, in lookup_pwned
    res = request_password_hash(head, logger)
  File "/usr/local/lib/python3.9/site-packages/keepassxc_pwned/password.py", line 20, in request_password_hash
    res = requests.get(
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.pwnedpasswords.com', port=443): Max retries exceeded with url: /range/385D0 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fc2dc3ae460>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Look into using httpx/fixing this issue.

opensource-assist commented 4 years ago

I should note that I use dnscrypt-proxy as a local recursive DNS resolver on my system.

seanbreckenridge commented 4 years ago

Is this reproducible on your end in any way or do you think it was an artifact of it being the first time you requested api.pwnedpasswords.com?

opensource-assist commented 4 years ago

@seanbreckenridge

Is this reproducible on your end in any way or do you think it was an artifact of it being the first time you requested api.pwnedpasswords.com?

I don't know why, but it's not reproducible now. I had such issues of something not being resolved with dnscrypt-proxy on my system and I do have it with some other websites right now. This must have been an issue with dnscrypt-proxy, but I thought it was from keepassxc-pwned; so please close this issue now. dnscrypt-proxy has been really bothering me for a while.