grr/server/grr_response_server/gui/api_regression_http.py
def _PrepareV1Request(self, method, args=None):
    """Prepares API v1 request for a given method and args."""

    args_proto = None
    if args:
      args_proto = args.AsPrimitiveProto()
    request = self.connector.BuildRequest(method, args_proto)
    request.url = request.url.replace("/api/v2/", "/api/")
    if args and request.data:
      body_proto = args.__class__().AsPrimitiveProto()
      json_format.Parse(request.data, body_proto)
      body_args = args.__class__()
      body_args.ParseFromString(body_proto.SerializeToString())
      request.data = json.dumps(
          api_value_renderers.StripTypeInfo(
              api_value_renderers.RenderValue(body_args)),
          cls=http_api.JSONEncoderWithRDFPrimitivesSupport)

    prepped_request = request.prepare()

    return request, prepped_request
Prepares API v1 request for a given method and args.
Prepares API v1 request for a given method and args.
Prepares API v1 request for a given method and args .
def _PrepareV1Request(self, method, args=None):
    args_proto = None
    if args:
      args_proto = args.AsPrimitiveProto()
    request = self.connector.BuildRequest(method, args_proto)
    request.url = request.url.replace("/api/v2/", "/api/")
    if args and request.data:
      body_proto = args.__class__().AsPrimitiveProto()
      json_format.Parse(request.data, body_proto)
      body_args = args.__class__()
      body_args.ParseFromString(body_proto.SerializeToString())
      request.data = json.dumps(
          api_value_renderers.StripTypeInfo(
              api_value_renderers.RenderValue(body_args)),
          cls=http_api.JSONEncoderWithRDFPrimitivesSupport)
    prepped_request = request.prepare()
    return request, prepped_request
def _PrepareV1Request ( self , method , args = None ) : args_proto = None if args : args_proto = args . AsPrimitiveProto ( ) request = self . connector . BuildRequest ( method , args_proto ) request . url = request . url . replace ( "/api/v2/" , "/api/" ) if args and request . data : body_proto = args . __class__ ( ) . AsPrimitiveProto ( ) json_format . Parse ( request . data , body_proto ) body_args = args . __class__ ( ) body_args . ParseFromString ( body_proto . SerializeToString ( ) ) request . data = json . dumps ( api_value_renderers . StripTypeInfo ( api_value_renderers . RenderValue ( body_args ) ) , cls = http_api . JSONEncoderWithRDFPrimitivesSupport ) prepped_request = request . prepare ( ) return request , prepped_request
Prepares API v1 request for a given method and args.
Prepares API v1 request for a given method and args .
"""Prepares API v1 request for a given method and args."""
self
method
args