Commit cbd383c1 authored by Alexandre Dulaunoy's avatar Alexandre Dulaunoy
Browse files

Only fetch NIST dump in gzip format when populating due to:

"Effective October 16, 2015 the XML data feeds will no longer be
available for download in an uncompressed format."

https://nvd.nist.gov/Data-Feeds/datafeedinfo

Reported by @Grazfather - Fix #98
parent abccbe85
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import datetime
import configparser
import urllib.parse
import urllib.request as req
from io import BytesIO
import gzip

class Configuration():
    ConfigParser = configparser.ConfigParser()
@@ -317,5 +319,9 @@ class Configuration():
            auth = req.HTTPBasicAuthHandler()
            opener = req.build_opener(proxy, auth, req.HTTPHandler)
            req.install_opener(opener)
        return req.urlopen(getfile)
        response = req.urlopen(getfile + '.gz')
        if 'gzip' in response.info().get('Content-Type'):
            buf = BytesIO(response.read())
            response = gzip.GzipFile(fileobj=buf)
        return response