Skip to content

Commit 501291d

Browse files
committed
add query params that are added to the url but not quoted
1 parent 341795c commit 501291d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mergin/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ def get(self, path, data=None, headers={}, validate_auth=True):
273273
request = urllib.request.Request(url, headers=headers)
274274
return self._do_request(request, validate_auth=validate_auth)
275275

276-
def post(self, path, data=None, headers={}, validate_auth=True):
276+
def post(self, path, data=None, headers={}, validate_auth=True, query_params: dict[str, str] = None):
277277
url = urllib.parse.urljoin(self.url, urllib.parse.quote(path))
278+
if query_params:
279+
url += "?" + urllib.parse.urlencode(query_params)
278280
if headers.get("Content-Type", None) == "application/json":
279281
data = json.dumps(data, cls=DateTimeEncoder).encode("utf-8")
280282
request = urllib.request.Request(url, data, headers, method="POST")

0 commit comments

Comments
 (0)