Ejemplo n.º 1
0
def dpma_published_data_search_real(query, options):
    options = options or {}
    depatisnet = DpmaDepatisnetAccess()
    data = depatisnet.search_patents(query, options)
    #print data.prettify()      # debugging

    # Raise an exception on empty results to skip caching this response
    if data.meta.navigator.count_total == 0:
        raise NoResultsException('No results', data=data)

    return data
Ejemplo n.º 2
0
def depatech_search(query, options=None):

    options = options or SmartBunch()

    client = get_depatech_client()
    try:
        data = client.search(query, options)
        # Raise an exception on empty results to skip caching this response
        if data.meta.navigator.count_total == 0:
            raise NoResultsException('No results', data=data)
        return data

    except SearchException as ex:
        client.stale = True
        raise
Ejemplo n.º 3
0
def sip_published_data_search(query, options):

    # <applicant type="inpadoc">grohe</applicant>
    # <applicant type="inpadoc">siemens</applicant>

    sip = get_sip_client()
    try:
        data = sip.search(query, options)

        # Raise an exception on empty results to skip caching this response
        if data.meta.navigator.count_total == 0:
            raise NoResultsException('No results', data=data)

        return data

    except SyntaxError as ex:
        log.warn('Invalid query for SIP: %s' % ex.msg)
        raise

    except SearchException as ex:
        if 'Call LOGIN' in ex.sip_info:
            sip.logout()
        raise
Ejemplo n.º 4
0
def ops_published_data_search_real(constituents, query, range):

    # OPS client object, impersonated for the current user.
    ops = get_ops_client()

    # Send request to OPS.
    range_begin, range_end = map(int, range.split('-'))
    response = ops.published_data_search(
        query, range_begin=range_begin, range_end=range_end, constituents=to_list(constituents))

    # Decode OPS response from JSON
    payload = handle_response(response, 'ops-search')

    if response.headers['content-type'].startswith('application/json'):

        # Decode total number of results.
        pointer_total_count = JsonPointer('/ops:world-patent-data/ops:biblio-search/@total-result-count')
        count_total = int(pointer_total_count.resolve(payload))

        # Raise an exception to skip caching empty results.
        if count_total == 0:
            raise NoResultsException('No results', data=payload)

        return payload