Pickling a gitlab-python result includes the auth details #2777
-
|
I have an instance with several thousand repos, where it's convenient to cache the top-level details for each in order to run various config checks. This boils down to: But then when I look at the pickle file, it includes the private token. When I also save the Expected BehaviorIt would be great if there was an easy way to exclude the token, or otherwise manage the "session" separately. Specifications
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Have you considered using https://python-gitlab.readthedocs.io/en/main/api-usage.html#as-a-dictionary Regarding the pickling: As a note, if on each But I have no idea how that will impact things when unpickling. You can look at the pickle file with: |
Beta Was this translation helpful? Give feedback.
-
|
Hi @JohnVillalovos, that does sound like a much better approach— it looks like it should be possible to then later do |
Beta Was this translation helpful? Give feedback.
-
|
Sorry, you are in uncharted territory on that. So I'm not sure. |
Beta Was this translation helpful? Give feedback.
Have you considered using
asdict()instead of pickling?https://python-gitlab.readthedocs.io/en/main/api-usage.html#as-a-dictionary
Regarding the pickling:
As a note, if on each
Projectobject you didproject.manager.gitlab.private_token = "*masked*"before pickling, that would get rid of the token most likely.But I have no idea how that will impact things when unpickling.
You can look at the pickle file with:
python -m pickletools projects.pickle