summaryrefslogtreecommitdiff
path: root/saharaclient/api/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'saharaclient/api/base.py')
-rw-r--r--saharaclient/api/base.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/saharaclient/api/base.py b/saharaclient/api/base.py
index c2c9c36..ee85c2d 100644
--- a/saharaclient/api/base.py
+++ b/saharaclient/api/base.py
@@ -17,6 +17,7 @@ import json
import logging
import six
+from six.moves.urllib import parse
from saharaclient.openstack.common.gettextutils import _
@@ -161,3 +162,12 @@ class APIException(Exception):
self.error_code = error_code
self.error_name = error_name
self.error_message = error_message
+
+
+def get_query_string(search_opts):
+ if search_opts:
+ qparams = sorted(search_opts.items(), key=lambda x: x[0])
+ query_string = "?%s" % parse.urlencode(qparams)
+ else:
+ query_string = ""
+ return query_string \ No newline at end of file