warn-scraper 1.2.93__py3-none-any.whl → 1.2.95__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- warn/scrapers/va.py +13 -11
- warn/utils.py +5 -3
- {warn_scraper-1.2.93.dist-info → warn_scraper-1.2.95.dist-info}/METADATA +1 -1
- {warn_scraper-1.2.93.dist-info → warn_scraper-1.2.95.dist-info}/RECORD +8 -8
- {warn_scraper-1.2.93.dist-info → warn_scraper-1.2.95.dist-info}/LICENSE +0 -0
- {warn_scraper-1.2.93.dist-info → warn_scraper-1.2.95.dist-info}/WHEEL +0 -0
- {warn_scraper-1.2.93.dist-info → warn_scraper-1.2.95.dist-info}/entry_points.txt +0 -0
- {warn_scraper-1.2.93.dist-info → warn_scraper-1.2.95.dist-info}/top_level.txt +0 -0
warn/scrapers/va.py
CHANGED
@@ -116,19 +116,21 @@ def scrape(
|
|
116
116
|
chromeoptionsholder.add_argument("--remote-debugging-pipe")
|
117
117
|
chromeoptionsholder.add_argument("--verbose")
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
)
|
119
|
+
if "CHROMEWEBDRIVER" in os.environ:
|
120
|
+
chrome_install = os.environ["CHROMEWEBDRIVER"]
|
121
|
+
else:
|
122
|
+
chrome_install = ChromeDriverManager().install()
|
123
|
+
|
124
|
+
# Weird error with finding the driver name in Windows. Sometimes.
|
125
|
+
if chrome_install.endswith("THIRD_PARTY_NOTICES.chromedriver"):
|
126
|
+
chrome_install = chrome_install.replace(
|
127
|
+
"THIRD_PARTY_NOTICES.chromedriver", "chromedriver.exe"
|
128
|
+
)
|
126
129
|
logger.debug(f"Chrome install variable is {chrome_install}")
|
127
|
-
# folder = os.path.dirname(chrome_install)
|
128
|
-
# chromedriver_path = folder # os.path.join(folder, "chromedriver.exe")
|
129
|
-
# service = ChromeService(chromedriver_path)
|
130
130
|
service = ChromeService(chrome_install)
|
131
|
-
driver = webdriver.Chrome(
|
131
|
+
driver = webdriver.Chrome(
|
132
|
+
options=chromeoptionsholder, service=service, service_args=["--verbose"]
|
133
|
+
)
|
132
134
|
logger.debug(f"Attempting to fetch {csv_url}")
|
133
135
|
driver.get(csv_url)
|
134
136
|
|
warn/utils.py
CHANGED
@@ -86,7 +86,7 @@ def save_if_good_url(filename, url, **kwargs):
|
|
86
86
|
success_flag = False
|
87
87
|
content = False
|
88
88
|
else:
|
89
|
-
with open(filename, "wb"
|
89
|
+
with open(filename, "wb") as outfile:
|
90
90
|
outfile.write(response.content)
|
91
91
|
success_flag = True
|
92
92
|
content = response.content
|
@@ -109,7 +109,9 @@ def write_rows_to_csv(output_path: Path, rows: list, mode="w"):
|
|
109
109
|
writer.writerows(rows)
|
110
110
|
|
111
111
|
|
112
|
-
def write_dict_rows_to_csv(
|
112
|
+
def write_dict_rows_to_csv(
|
113
|
+
output_path, headers, rows, mode="w", extrasaction="raise", encoding="utf-8"
|
114
|
+
):
|
113
115
|
"""Write the provided dictionary to the provided path as comma-separated values.
|
114
116
|
|
115
117
|
Args:
|
@@ -121,7 +123,7 @@ def write_dict_rows_to_csv(output_path, headers, rows, mode="w", extrasaction="r
|
|
121
123
|
"""
|
122
124
|
create_directory(output_path, is_file=True)
|
123
125
|
logger.debug(f"Writing {len(rows)} rows to {output_path}")
|
124
|
-
with open(output_path, mode, newline="") as f:
|
126
|
+
with open(output_path, mode, newline="", encoding=encoding) as f:
|
125
127
|
# Create the writer object
|
126
128
|
writer = csv.DictWriter(f, fieldnames=headers, extrasaction=extrasaction)
|
127
129
|
# If we are writing a new row ...
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: warn-scraper
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.95
|
4
4
|
Summary: Command-line interface for downloading WARN Act notices of qualified plant closings and mass layoffs from state government websites
|
5
5
|
Home-page: https://github.com/biglocalnews/warn-scraper
|
6
6
|
Author: Big Local News
|
@@ -17,7 +17,7 @@ warn/__init__.py,sha256=A07JFY1TyaPtVIndBa7IvTk13DETqIkLgRdk0A-MCoE,85
|
|
17
17
|
warn/cache.py,sha256=hyta04_G-ALGwcKl4xNc7EgHS_xklyVD5d8SXNrJekY,5520
|
18
18
|
warn/cli.py,sha256=ZqyJwICdHFkn2hEgbArj_upbElR9-TSDlYDqyEGeexE,2019
|
19
19
|
warn/runner.py,sha256=oeGRybGwpnkQKlPzRMlKxhsDt1GN4PZoX-vUwrsPgos,1894
|
20
|
-
warn/utils.py,sha256=
|
20
|
+
warn/utils.py,sha256=SKwD4P2v2dlzix_zEqb98ZYe-E98Pa0xXxzUFt3rwYY,7087
|
21
21
|
warn/platforms/__init__.py,sha256=wIZRDf4tbTuC8oKM4ZrTAtwNgbtMQGzPXMwDYCFyrog,81
|
22
22
|
warn/platforms/job_center/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
23
|
warn/platforms/job_center/cache.py,sha256=yhA3sE46lNFg8vEewSoRYVByi0YSlkBiKm7qoSUiTdM,1868
|
@@ -61,13 +61,13 @@ warn/scrapers/sd.py,sha256=_4R19Ybzsyx1PvcWV3_laJmJ3etrwVGfhNEQm6njwoA,1904
|
|
61
61
|
warn/scrapers/tn.py,sha256=i1H7c09Ea3CDrTXqqRMLBMPT_34QtGA0-x7T8rm_j5Q,2945
|
62
62
|
warn/scrapers/tx.py,sha256=watfR1gyN9w7nluiAOnnIghEmoq3eShNUzYSZ8SkZy4,4438
|
63
63
|
warn/scrapers/ut.py,sha256=iUh38YIjbvv5MyyKacsiZNe8KjfdBeDaOf-qMQEF_kc,2245
|
64
|
-
warn/scrapers/va.py,sha256=
|
64
|
+
warn/scrapers/va.py,sha256=JLrhNHxQ44lCwXJkmSSyQQLucYQ9qs5GU9owwjuDyOg,7803
|
65
65
|
warn/scrapers/vt.py,sha256=d-bo4WK2hkrk4BhCCmLpEovcoZltlvdIUB6O0uaMx5A,1186
|
66
66
|
warn/scrapers/wa.py,sha256=UXdVtHZo_a-XfoiyOooTRfTb9W3PErSZdKca6SRORgs,4282
|
67
67
|
warn/scrapers/wi.py,sha256=ClEzXkwZbop0W4fkQgsb5oHAPUrb4luUPGV-jOKwkcg,4855
|
68
|
-
warn_scraper-1.2.
|
69
|
-
warn_scraper-1.2.
|
70
|
-
warn_scraper-1.2.
|
71
|
-
warn_scraper-1.2.
|
72
|
-
warn_scraper-1.2.
|
73
|
-
warn_scraper-1.2.
|
68
|
+
warn_scraper-1.2.95.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
69
|
+
warn_scraper-1.2.95.dist-info/METADATA,sha256=LzOK3ChrTaldK164Uxi8tdKnSsUWDAlgl5j0biYvUaY,2118
|
70
|
+
warn_scraper-1.2.95.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
71
|
+
warn_scraper-1.2.95.dist-info/entry_points.txt,sha256=poh_oSweObGlBSs1_2qZmnTodlOYD0KfO7-h7W2UQIw,47
|
72
|
+
warn_scraper-1.2.95.dist-info/top_level.txt,sha256=gOhHgNEkrUvajlzoKkVOo-TlQht9MoXnKOErjzqLGHo,11
|
73
|
+
warn_scraper-1.2.95.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|