Closed anchuste closed 5 years ago
I am using pythoon 3.7
There seems to be a problem in your Python setup.
This is how to setup a Python virtual environment that contains requests_pkcs12
, which I just verified to work with Python 3.7 on Debian/Stable:
mkdir test
cd test
python3 -m virtualenv -p python3 .venv
pipenv install requests_pkcs12
You can start the Python interpreter inside the environment as follows:
pipenv run python3
There, requests_pkcs12
works without any problems:
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from requests_pkcs12 import Pkcs12Adapter
>>> Pkcs12Adapter
<class 'requests_pkcs12.Pkcs12Adapter'>
Hello, thanks for your response.
I think there is a problem with the other libraries that I have installed on my python repository. I have more libraries installed than "requests_pkcs12", obviously. I can not use a python environment with just "requests_pkcs12" package installed.
Maybe is it a problem with package "requests"? I do not know...
Finally, I used another library for my purpose:
from requests.adapters import HTTPAdapter
that allows to create a session with SSL certificate, key file and passphrase, in this way: session.mount(TEST_URL, SSLAdapter(CRT_FILE_PATH, KEY_FILE_PATH, 'YourPass')
Best wishes.
I'm glad you found a solution for your problem!
Just one final remark regarding a possible misunderstanding:
The pipenv
hint was indeed meant to help you to create clean start for you whole project, not just for one single library. You can just install more packages this way, and they all will be contained cleanly in the project directory:
pipenv install requests_pkcs12 package2 package3
You can also install packages one after another, upgrade, etc.:
pipenv install requests_pkcs12
pipenv install package2
pipenv install package3
Moreover, pipenv
is not some obscure tool, but the one package management tool the Python community finally agreed on:
I strongly recommend using this to create (and to reliably recreate) the Python setup of your project, to avoid similar issues in the future (or at least to be able to analyze and fix them quickly).
Regards, Volker
Thanks for your supporting!
I will try with your recommendations.
When i import library with command from requests_pkcs12 import get i receive error:
No module named 'cryptography.hazmat.bindings._constant_time'
Any idea?
Thanks.