Skip to content

Commit 30a4b84

Browse files
authored
merge: Merge pull request #14 from DSD-DBS/feat-serialize-attachments
Feat serialize attachments
2 parents 632b363 + 3feeedb commit 30a4b84

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ venv.bak/
137137
.spyderproject
138138
.spyproject
139139

140+
# VS Code settings
141+
.vscode/
142+
140143
# Rope project settings
141144
.ropeproject
142145

polarion_rest_api_client/data_models.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Data model classes returned by the client."""
44
from __future__ import annotations
55

6+
import base64
67
import dataclasses
78
import hashlib
89
import json
@@ -110,8 +111,13 @@ def calculate_checksum(self) -> str:
110111
del data["checksum"]
111112
del data["id"]
112113

113-
for at in data["attachments"]:
114-
del at["id"]
114+
for attachment in data["attachments"]:
115+
try:
116+
attachment["content_bytes"] = base64.b64encode(
117+
attachment["content_bytes"]
118+
).decode("utf8")
119+
except TypeError:
120+
pass
115121

116122
data = dict(sorted(data.items()))
117123

0 commit comments

Comments
 (0)