Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions mergin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ def get(self, path, data=None, headers={}, validate_auth=True):
request = urllib.request.Request(url, headers=headers)
return self._do_request(request, validate_auth=validate_auth)

def post(self, path, data=None, headers={}, validate_auth=True):
def post(self, path, data=None, headers={}, validate_auth=True, query_params: dict[str, str] = None):
url = urllib.parse.urljoin(self.url, urllib.parse.quote(path))
if query_params:
url += "?" + urllib.parse.urlencode(query_params)
if headers.get("Content-Type", None) == "application/json":
data = json.dumps(data, cls=DateTimeEncoder).encode("utf-8")
request = urllib.request.Request(url, data, headers, method="POST")
Expand Down Expand Up @@ -1420,7 +1422,7 @@ def send_logs(
if is_version_acceptable(self.server_version(), "2025.4.1") and (
diagnostic_logs_url is None or diagnostic_logs_url == ""
):
url = "v2/diagnostic-logs" + "?" + urllib.parse.urlencode(params)
url = "v2/diagnostic-logs"
use_server_api = True
else:
if diagnostic_logs_url:
Expand All @@ -1435,8 +1437,8 @@ def send_logs(
)

# We send more from the local logs
global_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.2
local_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.8
global_logs_file_size_to_send = int(MAX_LOG_FILE_SIZE_TO_SEND * 0.2)
local_logs_file_size_to_send = int(MAX_LOG_FILE_SIZE_TO_SEND * 0.8)

global_logs = b""
if global_log_file and os.path.exists(global_log_file):
Expand All @@ -1454,7 +1456,7 @@ def send_logs(
header = {"content-type": "text/plain"}

if use_server_api:
return self.post(url, data=payload, headers=header)
return self.post(url, data=payload, headers=header, query_params=params)
else:
request = urllib.request.Request(url, data=payload, headers=header)
return self._do_request(request)
Expand Down
2 changes: 1 addition & 1 deletion mergin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
UPLOAD_CHUNK_SIZE = 10 * 1024 * 1024

# size of the log file part to send (if file is larger only this size from end will be sent)
MAX_LOG_FILE_SIZE_TO_SEND = 8 * 1024 * 1024
MAX_LOG_FILE_SIZE_TO_SEND = 5 * 1024 * 1024

# default URL for submitting logs
MERGIN_DEFAULT_LOGS_URL = "https://g4pfq226j0.execute-api.eu-west-1.amazonaws.com/mergin_client_log_submit"
Expand Down