]> git.ipfire.org Git - pakfire.git/commitdiff
hub: Change how we append arguments to the request
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Mar 2023 09:27:11 +0000 (09:27 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Mar 2023 09:27:11 +0000 (09:27 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/hub.py

index 2c5df4fffed463ccb8f50dec4f003769b5ced18c..b334e096a57db6470213cb23c50c394e40a2af56 100644 (file)
@@ -71,6 +71,7 @@ class Hub(object):
        async def _request(self, method, path, websocket=False, authenticate=True,
                        body=None, body_producer=None, on_message_callback=None, **kwargs):
                headers = {}
+               query_args = {}
 
                # Make absolute URL
                url = urllib.parse.urljoin(self.url, path)
@@ -79,8 +80,17 @@ class Hub(object):
                if websocket and url.startswith("https://"):
                        url = url.replace("https://", "wss://")
 
-               # Convert any query arguments
-               query_args = urllib.parse.urlencode(kwargs)
+               # Filter all query arguments
+               for arg in kwargs:
+                       # Skip anything that is None
+                       if kwargs[arg] is None:
+                               continue
+
+                       # Add to query arguments
+                       query_args[arg] = kwargs[arg]
+
+               # Encode query arguments
+               query_args = urllib.parse.urlencode(query_args, doseq=True)
 
                # Add query arguments
                if method in ("GET", "PUT", "DELETE"):