Пример #1
0
 def scrape(self):
     primaryid = self.meta.get('primaryid')
     logger.debug('scrape %s', primaryid)
     if primaryid:
         m = meta.lookup(*primaryid)
         if m:
             m['primaryid'] = primaryid
             self.meta = m
             self.modified = datetime.utcnow()
             self.update()
             return True
         return False
     return True
Пример #2
0
def getMetadata(data):
    '''
        takes {
            key: value
            includeEdits: boolean
        }
        key can be one of the supported identifiers: isbn10, isbn13, oclc, olid,...
    '''
    logger.debug('getMetadata %s', data)
    if 'includeEdits' in data:
        include_edits = data.pop('includeEdits')
    else:
        include_edits = False
    key, value = next(iter(data.items()))
    value = cleanup_id(key, value)
    response = meta.lookup(key, value)
    if include_edits:
        response.update(models.Metadata.load(key, value))
    if response:
        response['primaryid'] = [key, value]
    return response
Пример #3
0
def getMetadata(data):
    '''
        takes {
            key: value
            includeEdits: boolean
        }
        key can be one of the supported identifiers: isbn10, isbn13, oclc, olid,...
    '''
    logger.debug('getMetadata %s', data)
    if 'includeEdits' in data:
        include_edits = data.pop('includeEdits')
    else:
        include_edits = False
    key, value = next(iter(data.items()))
    value = cleanup_id(key, value)
    response = meta.lookup(key, value)
    if include_edits:
        response.update(models.Metadata.load(key, value))
    if response:
        response['primaryid'] = [key, value]
    return response