def decode_arguments(self, environ): query_dict = parse_qs(environ['QUERY_STRING']) encoded_data = query_dict[self.REQ_PARAM][0] data = json.loads(urlsafe_base64_decode(encoded_data)) request_meta = data.get('request_meta', {}) request_meta['environ'] = environ return data['method'], data['args'], request_meta
def get_session_json(self): data = [] for exchange in self.session: req = dict(exchange[0].__dict__) req['url'] = urlparse.urlunparse(exchange[0].url) req['call'] = json.loads( urlsafe_base64_decode(str(exchange[0].query['req'][0]))) data.append({'request': req, 'response': exchange[1].__dict__}) return json.dumps(data)
def get_session_json(self): data = [] for exchange in self.session: req = dict(exchange[0].__dict__) req['url'] = urlparse.urlunparse(exchange[0].url) req['call'] = json.loads(urlsafe_base64_decode(str(exchange[0].query['req'][0]))) data.append({ 'request': req, 'response': exchange[1].__dict__}) return json.dumps(data)