Add missing encode_data() method to the Gridscale Connection class.
Without id, Logging connection won't be aware that the data needs to be
encoded as JSON and it won't work (actual HTTP requests would still work
because it relies on underlying requests behavior, but that's not
ideal).
Common settings and connection objects for gridscale
"""
+try:
+ import simplejson as json
+except Exception:
+ import json
+
from libcloud.common.base import BaseDriver, PollingConnection
from libcloud.common.base import ConnectionUserAndKey
from libcloud.common.base import JsonResponse
@@ -59,6 +64,9 @@ class GridscaleConnection(ConnectionUserAndKey, PollingConnection):
host = 'api.gridscale.io'
responseCls = GridscaleResponse
+ def encode_data(self, data):
+ return json.dumps(data)
+
def add_default_headers(self, headers):
"""
add parameters that are necessary for each request to be successful
