diff --git a/.gitignore b/.gitignore index 975287e9..4baa4a10 100644 --- a/.gitignore +++ b/.gitignore @@ -137,6 +137,9 @@ venv.bak/ .spyderproject .spyproject +# VS Code settings +.vscode/ + # Rope project settings .ropeproject diff --git a/polarion_rest_api_client/data_models.py b/polarion_rest_api_client/data_models.py index 1e7d80c6..41349bb4 100644 --- a/polarion_rest_api_client/data_models.py +++ b/polarion_rest_api_client/data_models.py @@ -3,6 +3,7 @@ """Data model classes returned by the client.""" from __future__ import annotations +import base64 import dataclasses import hashlib import json @@ -110,8 +111,13 @@ def calculate_checksum(self) -> str: del data["checksum"] del data["id"] - for at in data["attachments"]: - del at["id"] + for attachment in data["attachments"]: + try: + attachment["content_bytes"] = base64.b64encode( + attachment["content_bytes"] + ).decode("utf8") + except TypeError: + pass data = dict(sorted(data.items()))