def f(self, *args, **kwargs): json_data = getattr(cherrypy.request, 'json', kwargs) # Handle bin string translations json_data = decode_bin_strings(json_data) out_json = func(self, *args, **json_data) # Decode bin string translations out_json = encode_bin_strings(out_json) return out_json
def f(self, *args, **kwargs): if args: raise RuntimeError('Only supply kwargs') # Make the url url = self.host + ':' + str(self.port) + '/' + func.__name__ # Make the url request data = {} for key, val in kwargs.items(): data[key] = val # Handle bin string translations data = encode_bin_strings(data) # Get the server response return_data = self.query_server(url, data=data, cert_file=self.ssl_cert) # Decode bin string translations and return data return decode_bin_strings(return_data)