def encode_post_args(self, args, call_headers={}): if 'Content-Type' in call_headers and call_headers['Content-Type'] == 'application/x-www-form-urlencoded': return self.urlencode(args) if isinstance(args, unicode): encoded_args = self.encode_string_utf8(args) elif isinstance(args, dict): encoded_args = self.encode_dict_utf8(args) elif isinstance(args, list): encoded_args = self.encode_list_utf8(args) else: # If it's not something we know how to encode, we just pass it through encoded_args = args return json.dumps(encoded_args)
def _encode_options(options): headers = {'Accept': 'application/json;'} for item in options: headers['Accept'] += '; %s=%s' % (item, json.dumps(json.dumps(options[item]))) return headers
def encode_post_args(self, args): return json.dumps(args)