Skip to content

[Bug]: TypeError: HTTPSConnection.__init__() got an unexpected keyword argument 'key_file' #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
inyun2u opened this issue Apr 15, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@inyun2u
Copy link

inyun2u commented Apr 15, 2025

evernote-backup version

1.10.0

What OS are you using?

Windows

OS Version / Linux distribution

windows 10, ubuntu 24.04(wsl2)

Bug description

After proceeding OAuth, it show error as follows

Log excerpt

inyun2u@DESKTOP-5D0UB6O:~/evernote-backup$ poetry run evernote-backup --verbose init-db
Logging in to Evernote...
Using OAuth authentication...
Opening authorization page...
If it didn't open automatically, please copy this URL into your browser:
https://www.evernote.com/OAuth.action?oauth_token=bulkbackup.196372CD335.687474703A2F2F6C6F63616C686F73743A31303530302F6F617574685F63616C6C6261636B.098AE62CB402958ADC46C20D278DC100
gio: https://www.evernote.com/OAuth.action?oauth_token=bulkbackup.196372CD335.687474703A2F2F6C6F63616C686F73743A31303530302F6F617574685F63616C6C6261636B.098AE62CB402958ADC46C20D278DC100: Operation not supported
Authorizing auth token, evernote backend...
ERROR: Unknown exception
Traceback (most recent call last):
  File "/home/inyun2u/evernote-backup/evernote_backup/cli.py", line 84, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/home/inyun2u/evernote-backup/evernote_backup/cli.py", line 176, in init_db
    cli_app.init_db(
  File "/home/inyun2u/evernote-backup/evernote_backup/cli_app.py", line 46, in init_db
    note_client = get_sync_client(auth_token, backend, network_retry_count, 1, False)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/inyun2u/evernote-backup/evernote_backup/cli_app_auth.py", line 31, in get_sync_client
    client.verify_token()
  File "/home/inyun2u/evernote-backup/evernote_backup/evernote_client.py", line 69, in verify_token
    self.user_store.getUser()
  File "/home/inyun2u/evernote-backup/evernote_backup/evernote_client.py", line 171, in wrapper
    return functools.partial(
           ^^^^^^^^^^^^^^^^^^
  File "/home/inyun2u/evernote-backup/evernote_backup/evernote_client_util.py", line 28, in wrapper
    return fun(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/inyun2u/.cache/pypoetry/virtualenvs/evernote-backup-vjsflYeF-py3.12/lib/python3.12/site-packages/evernote/edam/userstore/UserStore.py", line 1123, in getUser
    self.send_getUser(authenticationToken)
  File "/home/inyun2u/.cache/pypoetry/virtualenvs/evernote-backup-vjsflYeF-py3.12/lib/python3.12/site-packages/evernote/edam/userstore/UserStore.py", line 1132, in send_getUser
    self._oprot.trans.flush()
  File "/home/inyun2u/.cache/pypoetry/virtualenvs/evernote-backup-vjsflYeF-py3.12/lib/python3.12/site-packages/thrift/transport/THttpClient.py", line 148, in flush
    self.open()
  File "/home/inyun2u/.cache/pypoetry/virtualenvs/evernote-backup-vjsflYeF-py3.12/lib/python3.12/site-packages/thrift/transport/THttpClient.py", line 113, in open
    self.__http = http_client.HTTPSConnection(self.host, self.port,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: HTTPSConnection.__init__() got an unexpected keyword argument 'key_file'
@inyun2u inyun2u added the bug Something isn't working label Apr 15, 2025
@vzhd1701
Copy link
Owner

Pull and check how it works now.

@inyun2u
Copy link
Author

inyun2u commented Apr 15, 2025

Thanks for your quick feedback. But unfortunately, I met those messages.

PS D:\Downloads\evernote-backup\evernote-backup> git pull
remote: Enumerating objects: 75, done.
remote: Counting objects: 100% (75/75), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 75 (delta 50), reused 74 (delta 49), pack-reused 0 (from 0)
Unpacking objects: 100% (75/75), 54.53 KiB | 29.00 KiB/s, done.
From https://github.com/vzhd1701/evernote-backup
   f1ece7a..13eb709  master     -> origin/master
 * [new tag]         v1.11.0    -> v1.11.0
Updating f1ece7a..13eb709
Fast-forward
 .github/workflows/release_github.yml             |    4 +-
 .pre-commit-config.yaml                          |    2 +-
 .versionrc.js                                    |    2 +
 CHANGELOG.md                                     |  145 +-
 README.md                                        |   15 +-
 evernote_backup/evernote_client.py               |  106 +-
 evernote_backup/evernote_client_api_http.py      |  212 ++
 evernote_backup/evernote_client_api_tokenized.py | 3376 ++++++++++++++++++++++
 evernote_backup/evernote_client_auth.py          |   33 +-
 evernote_backup/evernote_client_util.py          |   18 -
 evernote_backup/evernote_types.py                |    2 +-
 evernote_backup/note_synchronizer.py             |   18 +-
 evernote_backup/version.py                       |    2 +-
 poetry.lock                                      |    8 +-
 pyproject.toml                                   |    4 +-
 tests/conftest.py                                |   75 +-
 tests/test_evernote_client.py                    |  109 -
 tests/test_evernote_client_api.py                |   88 +
 tests/test_op_reauth.py                          |    2 +-
 20 files changed, 3862 insertions(+), 361 deletions(-)
 create mode 100644 evernote_backup/evernote_client_api_http.py
 create mode 100644 evernote_backup/evernote_client_api_tokenized.py
 delete mode 100644 tests/test_evernote_client.py
 create mode 100644 tests/test_evernote_client_api.py




PS D:\Downloads\evernote-backup\evernote-backup> python -m poetry install
Installing dependencies from lock file

Package operations: 0 installs, 1 update, 0 removals

  - Updating evernote-plus (1.28.1.dev0 -> 1.28.1.dev1)





PS D:\Downloads\evernote-backup\evernote-backup> python -m poetry run --verbose evernote-backup init-db
Found: C:\Users\inyun\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\python.exe
Using virtualenv: C:\Users\inyun\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\evernote-backup-btabUtDE-py3.13
Logging in to Evernote...
Using OAuth authentication...
Opening authorization page...
If it didn't open automatically, please copy this URL into your browser:
https://www.evernote.com/OAuth.action?oauth_token=bulkbackup.1963BD30DD5.687474703A2F2F6C6F63616C686F73743A31303530302F6F617574685F63616C6C6261636B.1209F58E6F21ED0B832D667994732BA0
Authorizing auth token, evernote backend...
ERROR: Unknown exception
Traceback (most recent call last):
  File "D:\Downloads\evernote-backup\evernote-backup\evernote_backup\cli.py", line 84, in wrapper
    return f(*args, **kwargs)
  File "D:\Downloads\evernote-backup\evernote-backup\evernote_backup\cli.py", line 176, in init_db
    cli_app.init_db(
    ~~~~~~~~~~~~~~~^
        database=database,
        ^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
        network_retry_count=network_retry_count,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\Downloads\evernote-backup\evernote-backup\evernote_backup\cli_app.py", line 46, in init_db
    note_client = get_sync_client(auth_token, backend, network_retry_count, 1, False)
  File "D:\Downloads\evernote-backup\evernote-backup\evernote_backup\cli_app_auth.py", line 31, in get_sync_client
    client.verify_token()
    ~~~~~~~~~~~~~~~~~~~^^
  File "D:\Downloads\evernote-backup\evernote-backup\evernote_backup\evernote_client.py", line 63, in verify_token
    self.user_store.getUser()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "D:\Downloads\evernote-backup\evernote-backup\evernote_backup\evernote_client_api_http.py", line 147, in wrapper
    return func(*args, **kwargs)
  File "D:\Downloads\evernote-backup\evernote-backup\evernote_backup\evernote_client_api_tokenized.py", line 351, in getUser
    return self._client.getUser(authenticationToken=self.authenticationToken)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\inyun\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\evernote-backup-btabUtDE-py3.13\Lib\site-packages\evernote\edam\userstore\UserStore.py", line 1099, in getUser
    self.send_getUser(authenticationToken)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\inyun\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\evernote-backup-btabUtDE-py3.13\Lib\site-packages\evernote\edam\userstore\UserStore.py", line 1108, in send_getUser
    self._oprot.trans.flush()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\inyun\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\Local\pypoetry\Cache\virtualenvs\evernote-backup-btabUtDE-py3.13\Lib\site-packages\thrift\transport\THttpClient.py", line 185, in flush
    self.__http.endheaders()
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1008.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1333, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1008.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1093, in _send_output
    self.send(msg)
    ~~~~~~~~~^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1008.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1037, in send
    self.connect()
    ~~~~~~~~~~~~^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1008.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1479, in connect
    self.sock = self._context.wrap_socket(self.sock,
                ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
                                          server_hostname=server_hostname)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1008.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        sock=sock,
        ^^^^^^^^^^
    ...<5 lines>...
        session=session
        ^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1008.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 1076, in _create
    self.do_handshake()
    ~~~~~~~~~~~~~~~~~^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.1008.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 1372, in do_handshake
    self._sslobj.do_handshake()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)
P

@vzhd1701 vzhd1701 reopened this Apr 16, 2025
@vzhd1701
Copy link
Owner

vzhd1701 commented Apr 16, 2025

I have added a dedicated connection debug function. Could you please pull, run this command and show me the result?

python -m poetry run evernote-backup -v manage ping

And if that one runs OK, run this one

python -m poetry run evernote_backup -v manage ping --use-system-ssl-ca

@inyun2u
Copy link
Author

inyun2u commented Apr 17, 2025

D:\Downloads\evernote-backup\evernote-backup>python -m poetry run evernote-backup -v manage ping
Connection OK!
DEBUG: Backend: evernote
DEBUG: UserStore endpoint URL: https://www.evernote.com/edam/user
DEBUG: Version check status: True

D:\Downloads\evernote-backup\evernote-backup>python -m poetry run evernote_backup -v manage ping --use-system-ssl-ca
'evernote_backup'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.

D:\Downloads\evernote-backup\evernote-backup>python -m poetry run evernote-backup -v manage ping --use-system-ssl-ca 
DEBUG: SSL CA store: system
DEBUG: SSL store stats: {'x509': 58, 'crl': 0, 'x509_ca': 56}
DEBUG: Received SSL certificate for host 'www.evernote.com':
DEBUG: {'OCSP': ('http://ocsp.int-r1.certainly.com',),      
 'caIssuers': ('http://int-r1.certainly.com',),
 'issuer': ((('countryName', 'US'),),
            (('organizationName', 'Certainly'),),
            (('commonName', 'Certainly Intermediate R1'),)),
 'notAfter': 'Apr 29 22:32:37 2025 GMT',
 'notBefore': 'Mar 30 22:32:38 2025 GMT',
 'serialNumber': '76F15EA1D2AF3A4F5D5F0C57B2612A87D2D3',
 'subject': ((('commonName', 'metrics.evernote.com'),),),
 'subjectAltName': (('DNS', 'content.evernote.com'),
                    ('DNS', 'metrics.evernote.com'),
                    ('DNS', 'www.evernote.com')),
 'version': 3}
DEBUG: SSL certificate domain(s): content.evernote.com, metrics.evernote.com, www.evernote.com
DEBUG: SSL certificate serial number: 76F15EA1D2AF3A4F5D5F0C57B2612A87D2D3
DEBUG: SSL certificate expiration date: Apr 29 22:32:37 2025 GMT
DEBUG: You can verify it here: https://mxtoolbox.com/SuperTool.aspx?action=https%3awww.evernote.com&run=toolpage
DEBUG: Certificate serial number should match, otherwise your firewall or proxy is intercepting HTTPS traffic
CRITICAL: SSL certificate verification failed for host 'www.evernote.com': [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)  

@vzhd1701
Copy link
Owner

vzhd1701 commented Apr 17, 2025

Seems like you have CA store misconfiguration in your system. Anyway your original problem should be fixed since I switched to certifi CA store by default now. Does the sync/init-db run OK for you now?

@inyun2u
Copy link
Author

inyun2u commented Apr 17, 2025

I will try this after fixing that problem or on another PC then I will tell you. Thanks for your kind support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants