Closed
Description
Description of the problem, including code/CLI snippet
Idea is to use Gitlab-Python to manage Labels in numerous project in a more scallable way π
MWE
# setup gl-py
gl = gitlab.Gitlab(GITLAB_ADRESS, private_token=TOKEN, ssl_verify=False)
gl.auth()
#get the project
src_prj = gl.projects.get(SRC_PRJ_ID)
# try to serialize the first Label Project
with open('data.txt', 'w') as outfile:
json.dump(src_prj.labels.list(all=True)[0], outfile)
Get the following
Traceback (most recent call last):
File "C:/Users/MPERIN/Git/labelautomation/labelmodel.py", line 79, in <module>
json.dump(src_prj.labels.list(all=True)[0], outfile)
File "C:\Users\MPERIN\AppData\Local\Continuum\miniconda3\envs\labelautomation\lib\json\__init__.py", line 179, in dump
for chunk in iterable:
File "C:\Users\MPERIN\AppData\Local\Continuum\miniconda3\envs\labelautomation\lib\json\encoder.py", line 438, in _iterencode
o = _default(o)
File "C:\Users\MPERIN\AppData\Local\Continuum\miniconda3\envs\labelautomation\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ProjectLabel is not JSON serializable
Expected Behavior
The Gilabl-python object are well serialized into JSON
Actual Behavior
The serialization crashes π
Specifications
- python-gitlab version: 2.2 (pip)
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): 11.10.0
Metadata
Metadata
Assignees
Labels
No labels