-
Notifications
You must be signed in to change notification settings - Fork 305
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
Python-Keycloak 4.3.0 Keycloak 25.0.2 NameError: name 'keycloak_openid' is not defined. Did you mean: 'KeycloakOpenID'? #589
Comments
You missed the instruction step to run
|
Yes, that block of code was already in place. To minimize confusion, here is the entire Python file. `from django.shortcuts import redirect keycloak_openid_connect = KeycloakOpenID( config_well_known = keycloak_openid.well_known() oauth_auth_request = keycloak_openid.KeycloakOpenID.auth_url( oauth_access_token = keycloak_openid.token( |
Change |
So I copied and pasted exacly what your example shows on the docs page and put in my variables, and both 'config_well_known' and 'oauth_auth_request' return module error. `from keycloak import KeycloakOpenID Configure client config_well_known = keycloak_openid.well_known() auth_url = keycloak_openid.auth_url( access_token = keycloak_openid.token(
|
Issue seems to be resolved once added "import keycloak" in the Python script. The keycloak and python-keycloak site-packets module relationship is confusing. I also use /auth in my URLS so I had to add the trailing / to the end of /auth. Now I am working thru 401 errors on the Keycloak side as I have not finished the Keycloak setup yet. Thanks for your help. |
I am following the example from the docs page at https://python-keycloak.readthedocs.io/en/latest/modules/openid_client.html and https://python-keycloak.readthedocs.io/en/latest/reference/keycloak/keycloak_openid/index.html. I am not sure what other modules the API client is expecting?
I have imported the module as:
from keycloak import KeycloakOpenID
Both
config_well_known = keycloak_openid.well_known()
andoauth_request = keycloak_openid.auth_url()
are failing with:NameError: name 'keycloak_openid' is not defined. Did you mean: 'KeycloakOpenID'? [justin@cm01]$ python keycloak_client.py Traceback (most recent call last): File "keycloak_client.py", line 25, in <module> oauth_request = keycloak_openid.auth_url( ^^^^^^^^^^^^^^^
My pip3 list is:
`Package Version
anyio 4.4.0
asgiref 3.8.1
async-property 0.2.2
boto3 1.34.151
botocore 1.34.151
certifi 2024.7.4
cffi 1.16.0
charset-normalizer 3.3.2
contourpy 1.2.1
cryptography 43.0.0
cycler 0.12.1
deprecation 2.1.0
Django 5.1
django-cors-headers 4.4.0
django-filter 24.3
djangorestframework 3.15.2
fonttools 4.53.1
h11 0.14.0
httpcore 1.0.5
httpx 0.27.0
idna 3.7
jmespath 1.0.1
jwcrypto 1.5.6
kiwisolver 1.4.5
markup 0.2.2
matplotlib 3.9.1
networkx 3.3
numpy 2.0.1
packaging 24.1
pillow 10.4.0
pip 24.2
psycopg 3.2.1
psycopg-binary 3.2.1
pycparser 2.22
pyparsing 3.1.2
python-dateutil 2.9.0.post0
python-keycloak 4.3.0
requests 2.32.3
requests-toolbelt 1.0.0
s3transfer 0.10.2
setuptools 72.1.0
six 1.16.0
sniffio 1.3.1
sqlparse 0.5.1
typing_extensions 4.12.2
urllib3 2.2.2
wheel 0.43.0
xlwt 1.3.0
`
The text was updated successfully, but these errors were encountered: