fulltext/routes.py
def retrieve(id_type: str, identifier: str, version: Optional[str] = None,
             content_fmt: str = SupportedFormats.PLAIN) -> Response:
    """Retrieve full-text content for an arXiv paper."""
    if identifier is None:
        raise BadRequest('identifier missing in request')
    available = ['application/json', 'text/plain']
    content_type = best_match(available, 'application/json')

    # Authorization is required to work with submissions.
    authorizer: Optional[Authorizer] = None
    if id_type == SupportedBuckets.SUBMISSION:
        authorizer = make_authorizer(scopes.READ_COMPILE)

    data, code, headers = controllers.retrieve(identifier, id_type, version,
                                               content_fmt=content_fmt,
                                               authorizer=authorizer)
    if content_type == 'text/plain':
        response_data = Response(data['content'], content_type='text/plain')
    elif content_type == 'application/json':
        if 'content' in data:
            data['content'] = data['content']
        response_data = jsonify(data)
    else:
        raise NotAcceptable('unsupported content type')
    response: Response = make_response(response_data, code, headers)
    return response
Retrieve full-text content for an arXiv paper.
Retrieve full-text content for an arXiv paper.
Retrieve full - text content for an arXiv paper .
def retrieve(id_type: str, identifier: str, version: Optional[str] = None,
             content_fmt: str = SupportedFormats.PLAIN) -> Response:
    if identifier is None:
        raise BadRequest('identifier missing in request')
    available = ['application/json', 'text/plain']
    content_type = best_match(available, 'application/json')
    authorizer: Optional[Authorizer] = None
    if id_type == SupportedBuckets.SUBMISSION:
        authorizer = make_authorizer(scopes.READ_COMPILE)
    data, code, headers = controllers.retrieve(identifier, id_type, version,
                                               content_fmt=content_fmt,
                                               authorizer=authorizer)
    if content_type == 'text/plain':
        response_data = Response(data['content'], content_type='text/plain')
    elif content_type == 'application/json':
        if 'content' in data:
            data['content'] = data['content']
        response_data = jsonify(data)
    else:
        raise NotAcceptable('unsupported content type')
    response: Response = make_response(response_data, code, headers)
    return response
def retrieve ( id_type : str , identifier : str , version : Optional [ str ] = None , content_fmt : str = SupportedFormats . PLAIN ) -> Response : if identifier is None : raise BadRequest ( 'identifier missing in request' ) available = [ 'application/json' , 'text/plain' ] content_type = best_match ( available , 'application/json' ) authorizer : Optional [ Authorizer ] = None if id_type == SupportedBuckets . SUBMISSION : authorizer = make_authorizer ( scopes . READ_COMPILE ) data , code , headers = controllers . retrieve ( identifier , id_type , version , content_fmt = content_fmt , authorizer = authorizer ) if content_type == 'text/plain' : response_data = Response ( data [ 'content' ] , content_type = 'text/plain' ) elif content_type == 'application/json' : if 'content' in data : data [ 'content' ] = data [ 'content' ] response_data = jsonify ( data ) else : raise NotAcceptable ( 'unsupported content type' ) response : Response = make_response ( response_data , code , headers ) return response
Retrieve full-text content for an arXiv paper.
Retrieve full - text content for an arXiv paper .
"""Retrieve full-text content for an arXiv paper.""" # Authorization is required to work with submissions.
id_type
str
identifier
str
version
Optional[str]
content_fmt
str