Ejemplo n.º 1
0
            self.contributor = attrs.get('contributor')
            self.vendor.append({'organization': self.organization, 'lastmodified': self.lastmodified, 'id': self.cvename, 'contributor': self.contributor, 'statement': self.statement})
            self.statementtag = True

    def characters(self, ch):
        if self.statementtag:
            self.statement += ch

    def endElement(self, name):
        if name == 'nvd:statement':
            self.statementtag = False
            self.statement = self.statement + self.statement.rstrip()
            self.vendor[-1]['statement'] = self.statement

# dictionary
vendordict = Configuration.getVendorDict()

# connect to db
db= Configuration.getMongoConnection()
vendor = db.vendor
info = db.info


parser = make_parser()
ch = VendorHandler()
parser.setContentHandler(ch)
f = urlopen(vendordict)
i = info.find_one({'db': 'vendor'})
if i is not None:
    if f.headers['last-modified'] == i['last-modified']:
        sys.exit("Not modified")
            self.contributor = attrs.get('contributor')
            self.vendor.append({'organization': self.organization, 'lastmodified': self.lastmodified, 'id': self.cvename, 'contributor': self.contributor, 'statement': self.statement})
            self.statementtag = True

    def characters(self, ch):
        if self.statementtag:
            self.statement += ch

    def endElement(self, name):
        if name == 'nvd:statement':
            self.statementtag = False
            self.statement = self.statement + self.statement.rstrip()
            self.vendor[-1]['statement'] = self.statement

# dictionary
vendordict = Configuration.getVendorDict()

# connect to db
db= Configuration.getMongoConnection()
vendor = db.vendor
info = db.info


parser = make_parser()
ch = VendorHandler()
parser.setContentHandler(ch)
f = urlopen(vendordict)
i = info.find_one({'db': 'vendor'})
if i is not None:
    if f.headers['last-modified'] == i['last-modified']:
        sys.exit("Not modified")