Instantiate a Request object from the arguments in a
        C{checkid_*} OpenID message
2898
def fromOpenIDRequest(cls, request):
        
        self = cls()
        args = request.message.getArgs(self.ns_uri)
        is_openid1 = request.message.isOpenID1()

        if args == {}:
            return None

        self.parseExtensionArgs(args, is_openid1)
        return self
791252
static function fromOpenIDRequest($request)
    {
        $m = $request->message;
        $obj = new Auth_OpenID_AX_FetchRequest();
        $ax_args = $m->getArgs($obj->ns_uri);

        $result = $obj->parseExtensionArgs($ax_args);

        if (Auth_OpenID_AX::isError($result)) {
            return $result;
        }

        if ($obj->update_url) {
            // Update URL must match the openid.realm of the
            // underlying OpenID 2 message.
            $realm = $m->getArg(Auth_OpenID_OPENID_NS, 'realm',
                        $m->getArg(
                                  Auth_OpenID_OPENID_NS,
                                  'return_to'));

            if (!$realm) {
                $obj = new Auth_OpenID_AX_Error(
                  sprintf("Cannot validate update_url %s " .
                          "against absent realm", $obj->update_url));
            } else if (!Auth_OpenID_TrustRoot::match($realm,
                                                     $obj->update_url)) {
                $obj = new Auth_OpenID_AX_Error(
                  sprintf("Update URL %s failed validation against realm %s",
                          $obj->update_url, $realm));
            }
        }

        return $obj;
    }
595223
def get(cls, id):
        '''
        
        '''
        client = cls._new_api_client()
        return client.make_request(cls, 'get', url_params={'id': id})
121600
def create_header(cls, request_id=None):
        ''' 

        '''
        header = {
            'msgid'   : bkserial.make_id(),
            'msgtype' : cls.msgtype
        }
        if request_id is not None:
            header['reqid'] = request_id
        return header
82912
function importRequest(endpointSchema, id, parentId) {
  const name = endpointSchema.summary || `${endpointSchema.method} ${endpointSchema.path}`;
  return {
    _type: 'request',
    _id: id,
    parentId: parentId,
    name,
    method: endpointSchema.method.toUpperCase(),
    url: '{{ base_url }}' + pathWithParamsAsVariables(endpointSchema.path),
    body: prepareBody(endpointSchema),
    headers: prepareHeaders(endpointSchema),
    parameters: prepareQueryParams(endpointSchema),
  };
}
1010172
def handleCheckIDRequest(request, openid_request):
    
    # If the request was an IDP-driven identifier selection request
    # (i.e., the IDP URL was entered at the RP), then return the
    # default identity URL for this server. In a full-featured
    # provider, there could be interaction with the user to determine
    # what URL should be sent.
    if not openid_request.idSelect():

        id_url = getViewURL(request, idPage)

        # Confirm that this server can actually vouch for that
        # identifier
        if id_url != openid_request.identity:
            # Return an error response
            error_response = ProtocolError(
                openid_request.message,
                "This server cannot verify the URL %r" %
                (openid_request.identity,))

            return displayResponse(request, error_response)

    if openid_request.immediate:
        # Always respond with 'cancel' to immediate mode requests
        # because we don't track information about a logged-in user.
        # If we did, then the answer would depend on whether that user
        # had trusted the request's trust root and whether the user is
        # even logged in.
        openid_response = openid_request.answer(False)
        return displayResponse(request, openid_response)
    else:
        # Store the incoming request object in the session so we can
        # get to it later.
        setRequest(request, openid_request)
        return showDecidePage(request, openid_request)
794671
def _parse_create_args(client, args):
    
    data = {}

    if args.get('quantity'):
        data['quantity'] = int(args.get('quantity'))
    if args.get('postinstall'):
        data['provisionScripts'] = [args.get('postinstall')]
    if args.get('complex_type'):
        data['complexType'] = args.get('complex_type')

    if args.get('fqdn'):
        servers = []
        for name in args.get('fqdn'):
            fqdn = name.split(".", 1)
            servers.append({'hostname': fqdn[0], 'domain': fqdn[1]})
        data['hardware'] = servers

    if args.get('image'):
        if args.get('image').isdigit():
            image_mgr = ImageManager(client)
            image_details = image_mgr.get_image(args.get('image'), mask="id,globalIdentifier")
            data['imageTemplateGlobalIdentifier'] = image_details['globalIdentifier']
        else:
            data['imageTemplateGlobalIdentifier'] = args['image']

    userdata = None
    if args.get('userdata'):
        userdata = args['userdata']
    elif args.get('userfile'):
        with open(args['userfile'], 'r') as userfile:
            userdata = userfile.read()
    if userdata:
        for hardware in data['hardware']:
            hardware['userData'] = [{'value': userdata}]

    # Get the SSH keys
    if args.get('key'):
        keys = []
        for key in args.get('key'):
            resolver = SshKeyManager(client).resolve_ids
            key_id = helpers.resolve_id(resolver, key, 'SshKey')
            keys.append(key_id)
        data['sshKeys'] = keys

    return data
880182
def finishOpenID(request):
    
    result = {}

    # Because the object containing the query parameters is a
    # MultiValueDict and the OpenID library doesn't allow that, we'll
    # convert it to a normal dict.

    # OpenID 2 can send arguments as either POST body or GET query
    # parameters.
    request_args = util.normalDict(request.GET)
    if request.method == 'POST':
        request_args.update(util.normalDict(request.POST))

    if request_args:
        c = getConsumer(request)

        # Get a response object indicating the result of the OpenID
        # protocol.
        return_to = util.getViewURL(request, finishOpenID)
        response = c.complete(request_args, return_to)

        # Get a Simple Registration response object if response
        # information was included in the OpenID response.
        sreg_response = {}
        ax_items = {}
        if response.status == consumer.SUCCESS:
            sreg_response = sreg.SRegResponse.fromSuccessResponse(response)

            ax_response = ax.FetchResponse.fromSuccessResponse(response)
            if ax_response:
                ax_items = ax_response.data

        # Get a PAPE response object if response information was
        # included in the OpenID response.
        pape_response = None
        if response.status == consumer.SUCCESS:
            pape_response = pape.Response.fromSuccessResponse(response)

            if not pape_response.auth_policies:
                pape_response = None

        # Map different consumer status codes to template contexts.
        results = {
            consumer.CANCEL:
            {'message': 'OpenID authentication cancelled.'},

            consumer.FAILURE:
            {'error': 'OpenID authentication failed.'},

            consumer.SUCCESS:
            {'url': response.getDisplayIdentifier(),
             'sreg_response': sreg_response and sreg_response.iteritems(),
             'ax_response': ax_items.items(),
             'pape': pape_response}
        }

        result = results[response.status]

        print result
        if not result.has_key("error"):
            data_array = [it[1][0] for it in result["ax_response"]]
            data = {
                "login": None,
                "openid": result["url"],
                "first_name": data_array[0],
                "last_name": data_array[1],
                "email": data_array[2],
            }
            return create_profil_from_ipenid(request, data)

        if isinstance(response, consumer.FailureResponse):
            # In a real application, this information should be
            # written to a log for debugging/tracking OpenID
            # authentication failures. In general, the messages are
            # not user-friendly, but intended for developers.
            result['failure_reason'] = response.message

    return renderIndexPage(request, **result)
1050769
def request(self, id, **kwargs):
        
        data = self.get('requests', id, **kwargs)
        return data
313800
function getRequestId(req) {
  const id = uuid.v1();
  req.id = id;
  return {
    req_id: id,
  };
}
1238228
def request_payload(cls, request, request_id):
        ''''''
        if isinstance(request.args, dict):
            raise ProtocolError.invalid_args(
                'JSONRPCv1 does not support named arguments')
        return {
            'method': request.method,
            'params': request.args,
            'id': request_id
        }
1205236
def get_id(self, request_data, parameter_name='id'):
        """"""
        if parameter_name not in request_data:
            raise ParseError("`{}` parameter is required".format(parameter_name))

        id_parameter = request_data.get(parameter_name, None)
        if not isinstance(id_parameter, int):
            raise ParseError("`{}` parameter not an integer".format(parameter_name))

        return id_parameter
1217964
def fromMessage(klass, message, op_endpoint=UNUSED):
        
        if message.isOpenID1():
            session_type = message.getArg(OPENID_NS, 'session_type')
            if session_type == 'no-encryption':
                logging.warn('Received OpenID 1 request with a no-encryption '
                            'assocaition session type. Continuing anyway.')
            elif not session_type:
                session_type = 'no-encryption'
        else:
            session_type = message.getArg(OPENID2_NS, 'session_type')
            if session_type is None:
                raise ProtocolError(message,
                                    text="session_type missing from request")

        try:
            session_class = klass.session_classes[session_type]
        except KeyError:
            raise ProtocolError(message,
                                "Unknown session type %r" % (session_type,))

        try:
            session = session_class.fromMessage(message)
        except ValueError, why:
            raise ProtocolError(message, 'Error parsing %s session: %s' %
                                (session_class.session_type, why[0]))

        assoc_type = message.getArg(OPENID_NS, 'assoc_type', 'HMAC-SHA1')
        if assoc_type not in session.allowed_assoc_types:
            fmt = 'Session type %s does not support association type %s'
            raise ProtocolError(message, fmt % (session_type, assoc_type))

        self = klass(session, assoc_type)
        self.message = message
        self.namespace = message.getOpenIDNamespace()
        return self
1025132
def xml_request(check_object=False, check_invalid_data_mover=False):
    

    def decorator(f):
        @functools.wraps(f)
        def func_wrapper(self, *argv, **kwargs):
            request = f(self, *argv, **kwargs)
            return self.request(
                request, check_object=check_object,
                check_invalid_data_mover=check_invalid_data_mover)

        return func_wrapper

    return decorator
169707
def usable_id(cls, id):
        
        try:
            # id is maybe a sshkey name
            qry_id = cls.from_name(id)
            if not qry_id:
                qry_id = int(id)
        except DuplicateResults as exc:
            cls.error(exc.errors)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
450463
function make_request_from_instance(params) {
        const this_endpoint = this;
        const { preparer } = this_endpoint;
        const headers = Object.assign(
            {},
            this_endpoint.headers,
            params.headers,
            ); // eslint-disable-line indent
        return this_endpoint.constructor.make_request(
            Object.assign({}, params, { headers, preparer }),
            compose_url_from_instance.bind(this_endpoint),
            ); // eslint-disable-line indent
    }
1175944
static function fromOpenIDRequest($request)
    {
        $obj = new Auth_OpenID_PAPE_Request();
        $args = $request->message->getArgs(Auth_OpenID_PAPE_NS_URI);

        if ($args === null || $args === array()) {
            return null;
        }

        $obj->parseExtensionArgs($args);
        return $obj;
    }