jnpr/space/factory.py
def fetch_resource(rest_end_point, href):
    """This is the method you should use to create a Resource instance if you
    have the href for it. It gets the current state of the resource with the
    given *href*. Once the current state is fetched from the Space server, this
    method creates a new instance of ``jnpr.space.resource.Resource`` with this
    state and returns it.

    :param rest_end_point: A *Space* object encapsulating the Junos
        Space cluster which contains this resource.
    :type rest_end_point: jnpr.space.rest.Space

    :param str href: The href of the resource that needs to be fetched.

    :returns: A new instance of jnpr.space.resource.Resource

    :raises: ``jnpr.space.rest.RestException`` if the GET request results in an
        error response. The exception's ``response`` attribute will have the
        full response from Space.
    """
    response = rest_end_point.get(href)
    if response.status_code != 200:
        raise rest.RestException("GET failed on %s" % href, response)

    media_type = response.headers['content-type']
    end = media_type.index('+')
    parts = media_type[:end].split('.')
    app_ = parts[len(parts)-3]
    service_ = parts[len(parts)-2]
    type_ = parts[len(parts)-1]

    if app_ == 'space':
        type_name = xmlutil.unmake_xml_name('.'.join([service_, type_]))
    else:
        type_name = xmlutil.unmake_xml_name('.'.join([app_, service_, type_]))

    xml_data = xmlutil.get_xml_obj_from_response(response)
    return make_resource(type_name, rest_end_point, xml_data)
This is the method you should use to create a Resource instance if you
    have the href for it. It gets the current state of the resource with the
    given *href*. Once the current state is fetched from the Space server, this
    method creates a new instance of ``jnpr.space.resource.Resource`` with this
    state and returns it.

    :param rest_end_point: A *Space* object encapsulating the Junos
        Space cluster which contains this resource.
    :type rest_end_point: jnpr.space.rest.Space

    :param str href: The href of the resource that needs to be fetched.

    :returns: A new instance of jnpr.space.resource.Resource

    :raises: ``jnpr.space.rest.RestException`` if the GET request results in an
        error response. The exception's ``response`` attribute will have the
        full response from Space.
    
This is the method you should use to create a Resource instance if you
have the href for it. It gets the current state of the resource with the
given *href*. Once the current state is fetched from the Space server, this
method creates a new instance of ``jnpr.space.resource.Resource`` with this
state and returns it.
This is the method you should use to create a Resource instance if you have the href for it . It gets the current state of the resource with the given * href * . Once the current state is fetched from the Space server this method creates a new instance of ` ` jnpr . space . resource . Resource ` ` with this state and returns it .
def fetch_resource(rest_end_point, href):
    response = rest_end_point.get(href)
    if response.status_code != 200:
        raise rest.RestException("GET failed on %s" % href, response)
    media_type = response.headers['content-type']
    end = media_type.index('+')
    parts = media_type[:end].split('.')
    app_ = parts[len(parts)-3]
    service_ = parts[len(parts)-2]
    type_ = parts[len(parts)-1]
    if app_ == 'space':
        type_name = xmlutil.unmake_xml_name('.'.join([service_, type_]))
    else:
        type_name = xmlutil.unmake_xml_name('.'.join([app_, service_, type_]))
    xml_data = xmlutil.get_xml_obj_from_response(response)
    return make_resource(type_name, rest_end_point, xml_data)
def fetch_resource ( rest_end_point , href ) : response = rest_end_point . get ( href ) if response . status_code != 200 : raise rest . RestException ( "GET failed on %s" % href , response ) media_type = response . headers [ 'content-type' ] end = media_type . index ( '+' ) parts = media_type [ : end ] . split ( '.' ) app_ = parts [ len ( parts ) - 3 ] service_ = parts [ len ( parts ) - 2 ] type_ = parts [ len ( parts ) - 1 ] if app_ == 'space' : type_name = xmlutil . unmake_xml_name ( '.' . join ( [ service_ , type_ ] ) ) else : type_name = xmlutil . unmake_xml_name ( '.' . join ( [ app_ , service_ , type_ ] ) ) xml_data = xmlutil . get_xml_obj_from_response ( response ) return make_resource ( type_name , rest_end_point , xml_data )
This is the method you should use to create a Resource instance if you
have the href for it.
This is the method you should use to create a Resource instance if you have the href for it .
"""This is the method you should use to create a Resource instance if you
    have the href for it. It gets the current state of the resource with the
    given *href*. Once the current state is fetched from the Space server, this
    method creates a new instance of ``jnpr.space.resource.Resource`` with this
    state and returns it.

    :param rest_end_point: A *Space* object encapsulating the Junos
        Space cluster which contains this resource.
    :type rest_end_point: jnpr.space.rest.Space

    :param str href: The href of the resource that needs to be fetched.

    :returns: A new instance of jnpr.space.resource.Resource

    :raises: ``jnpr.space.rest.RestException`` if the GET request results in an
        error response. The exception's ``response`` attribute will have the
        full response from Space.
    """
A new instance of jnpr.space.resource.Resource
A new instance of jnpr . space . resource . Resource
``jnpr.space.rest.RestException`` if the GET request results in an
error response. The exception's ``response`` attribute will have the
full response from Space.
` ` jnpr . space . rest . RestException ` ` if the GET request results in an error response . The exception ' s ` ` response ` ` attribute will have the full response from Space .
rest_end_point
A *Space* object encapsulating the Junos
Space cluster which contains this resource.
A * Space * object encapsulating the Junos Space cluster which contains this resource .
href
The href of the resource that needs to be fetched.
The href of the resource that needs to be fetched .