Skip to content

Commit ece0cdc

Browse files
committed
Revert scraper module to its last stable state #16
Signed-off-by: Thomas Druez <tdruez@nexb.com>
1 parent 501427e commit ece0cdc

4 files changed

Lines changed: 9 additions & 20 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Tests
2424
-----
2525

2626
```
27-
pycodestyle --exclude=migrations,settings.py,lib --max-line-length=100 .
27+
pycodestyle --exclude=migrations,settings.py,lib,tests --max-line-length=100 .
2828
python3.6 -m pytest -v tests/
2929
```
3030

scraper/debian.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ def extract_cves_from_tracker(html):
7474
elif tag.find_all('span', {'class': 'red'}) and tag.text == 'high**' or tag.text == 'high':
7575
vulnerability_status.append(tag.text)
7676

77-
return([{'cve_id': cve_id,
78-
'package_name': name,
79-
'vulnerability_status': status}
80-
for cve_id, name, status in zip(cve_id,
81-
package_name,
82-
vulnerability_status)])
77+
return cve_id, package_name, vulnerability_status
8378

8479

8580
def scrape_cves():

scraper/ubuntu.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@ def extract_cves(html):
5252
pkg = re.findall('pkg/(.+)\.html', href)
5353
package_name.append(pkg[0])
5454

55-
return([{'cve_id': cve_id,
56-
'package_name': name,
57-
'vulnerability_status': status}
58-
for cve_id, name, status in zip(cve_id,
59-
package_name,
60-
vulnerability_status)])
55+
return cve_id, vulnerability_status, package_name
6156

6257

6358
def scrape_cves():

tests/test_scrapers.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ def test_ubuntu_extract_cves():
4646
"""
4747

4848
expected = (
49-
[{'cve_id': 'CVE-2002-2439',
50-
'package_name': 'gcc-4.4',
51-
'vulnerability_status': 'High'}]
49+
['CVE-2002-2439'],
50+
['High'],
51+
['gcc-4.4'],
5252
)
53-
5453
assert expected == ubuntu.extract_cves(test_input)
5554

5655

@@ -118,9 +117,9 @@ def test_debian_extract_cves_from_tracker():
118117
"""
119118

120119
expected = (
121-
[{'cve_id': 'CVE-2016-5416',
122-
'package_name': '389-ds-base',
123-
'vulnerability_status': 'not yet assigned'}]
120+
['CVE-2016-5416'],
121+
['389-ds-base'],
122+
['not yet assigned'],
124123
)
125124

126125
assert expected == debian.extract_cves_from_tracker(test_input)

0 commit comments

Comments
 (0)