Open samanooo opened 2 years ago
Is it a bug? Could someone please answer this?
I tried to uninstall and install openshift several times, but no luck, and get the same error
Hello, could you please answer me where did you find this implementation. Because on official Red Hat I couldn't find a thread that imports the DynamicClient like you do. So could you please explain me or give me the link on which you saw it first time? Thank you!
Also repository is private and I can not see the code in order to try to help you more
I'm trying to login to openshift from the following python script:
from kubernetes import client from openshift.dynamic import DynamicClient from openshift.helper.userpassauth import OCPLoginConfiguration from getpass import getpass
password = getpass()
apihost = "api" username = "username" password = password
kubeConfig = OCPLoginConfiguration(ocp_username=username, ocp_password=password) kubeConfig.host = apihost
kubeConfig.verify_ssl = True kubeConfig.ssl_ca_cert = './ocp.pem' # use a certificate bundle for the TLS validation
kubeConfig.get_token()
print('Auth token: {0}'.format(kubeConfig.api_key)) print('Token expires: {0}'.format(kubeConfig.api_key_expires))
However, I'm getting this error:
File "/home/python/Openshift/openshift.py", line 5, in
from openshift.dynamic import DynamicClient
ModuleNotFoundError: No module named 'openshift.dynamic'; 'openshift' is not a package
I have already installed openshift package:
$ pip3 list | grep openshift openshift 0.13.1 openshift-client 1.0.17
$ python3 --version Python 3.9.7
Could someone please advise what's wrong with my code or package? Thanks.