personal_access_tokens.rotate(<ID>) 'dict' object has no attribute 'token'
FearTheBadger opened this issue · comments
Brock R commented
Description of the problem, including code/CLI snippet
When using this labrary to rotate a personal access token, there is no token attribute to the resulting dict object.
Expected Behavior
That the new token is present in the object.
Actual Behavior
Taken from:
https://python-gitlab.readthedocs.io/en/stable/gl_objects/personal_access_tokens.html
new_token = gl.personal_access_tokens.rotate(1630)
print(new_token.token)
Traceback (most recent call last):
File "blahblah/./rotate_token", line 12, in <module>
print(new_token.token)
AttributeError: 'dict' object has no attribute 'token'
Specifications
- python-gitlab version: 4.4.0
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): 16.8.1-ee
John Villalovos commented
It is a dictionary thus access is not done via attributes.
Nejc Habjan commented
We might need to update the docs there a bit.
new_token = gl.personal_access_tokens.rotate(1630)
print(new_token["token"])
Brock R commented
Thanks for the clarification.