warn-scraper 1.2.83__py3-none-any.whl → 1.2.85__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/md.py +37 -9
- warn/scrapers/tx.py +4 -2
- {warn_scraper-1.2.83.dist-info → warn_scraper-1.2.85.dist-info}/METADATA +1 -1
- {warn_scraper-1.2.83.dist-info → warn_scraper-1.2.85.dist-info}/RECORD +8 -8
- {warn_scraper-1.2.83.dist-info → warn_scraper-1.2.85.dist-info}/LICENSE +0 -0
- {warn_scraper-1.2.83.dist-info → warn_scraper-1.2.85.dist-info}/WHEEL +0 -0
- {warn_scraper-1.2.83.dist-info → warn_scraper-1.2.85.dist-info}/entry_points.txt +0 -0
- {warn_scraper-1.2.83.dist-info → warn_scraper-1.2.85.dist-info}/top_level.txt +0 -0
warn/scrapers/md.py
CHANGED
@@ -36,9 +36,13 @@ def scrape(
|
|
36
36
|
# Set the cache
|
37
37
|
cache = Cache(cache_dir)
|
38
38
|
|
39
|
+
# In November 2024 Maryland began throwing out many failed connection messages. These two things helped.
|
40
|
+
request_headers = {"User-Agent": "BigLocalNews.org"}
|
41
|
+
request_verify = False
|
42
|
+
|
39
43
|
# Get the page
|
40
44
|
url = "https://www.dllr.state.md.us/employment/warn.shtml"
|
41
|
-
r = utils.get_url(url)
|
45
|
+
r = utils.get_url(url, headers=request_headers, verify=request_verify)
|
42
46
|
r.encoding = "utf-8"
|
43
47
|
html = r.text
|
44
48
|
|
@@ -56,17 +60,41 @@ def scrape(
|
|
56
60
|
html_list = []
|
57
61
|
html_list.append(html) # Save the source HTML for parsing also
|
58
62
|
|
63
|
+
old_pages = [
|
64
|
+
"warn2023.shtml",
|
65
|
+
"warn2022.shtml",
|
66
|
+
"warn2021.shtml",
|
67
|
+
"warn2020.shtml",
|
68
|
+
"warn2019.shtml",
|
69
|
+
"warn2018.shtml",
|
70
|
+
"warn2017.shtml",
|
71
|
+
"warn2016.shtml",
|
72
|
+
"warn2015.shtml",
|
73
|
+
"warn2014.shtml",
|
74
|
+
"warn2013.shtml",
|
75
|
+
"warn2012.shtml",
|
76
|
+
"warn2011.shtml",
|
77
|
+
"warn2010.shtml",
|
78
|
+
]
|
79
|
+
|
59
80
|
for href in href_list:
|
60
81
|
# Request the HTML
|
61
82
|
url = f"https://www.dllr.state.md.us/employment/{href}"
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
83
|
+
filename = cache_dir / f"md/{href}.html"
|
84
|
+
|
85
|
+
if href not in old_pages:
|
86
|
+
sleep(naptime) # Try to stop blocked connections by being less aggressive
|
87
|
+
r = utils.get_url(url, headers=request_headers, verify=request_verify)
|
88
|
+
r.encoding = "utf-8"
|
89
|
+
html = r.text
|
90
|
+
|
91
|
+
# Save it to the cache
|
92
|
+
cache.write(filename, html)
|
93
|
+
else:
|
94
|
+
r = utils.fetch_if_not_cached(
|
95
|
+
filename, url, headers=request_headers, verify=request_verify
|
96
|
+
)
|
97
|
+
html = cache.read(filename)
|
70
98
|
|
71
99
|
# Add it to the list
|
72
100
|
html_list.append(html)
|
warn/scrapers/tx.py
CHANGED
@@ -31,12 +31,14 @@ def scrape(
|
|
31
31
|
|
32
32
|
Returns: the Path where the file is written
|
33
33
|
"""
|
34
|
+
ssl_verify = False # Problems with certificates in November 2024
|
35
|
+
|
34
36
|
# Set up the cache
|
35
37
|
cache = Cache(cache_dir)
|
36
38
|
|
37
39
|
# Get the root URL
|
38
40
|
url = "https://www.twc.texas.gov/data-reports/warn-notice"
|
39
|
-
page = utils.get_url(url)
|
41
|
+
page = utils.get_url(url, verify=ssl_verify)
|
40
42
|
html = page.text
|
41
43
|
|
42
44
|
# Cache it
|
@@ -68,7 +70,7 @@ def scrape(
|
|
68
70
|
# download the excel file
|
69
71
|
year = _get_year(href)
|
70
72
|
ext = _get_ext(href)
|
71
|
-
excel_path = cache.download(f"tx/{year}{ext}", data_url)
|
73
|
+
excel_path = cache.download(f"tx/{year}{ext}", data_url, verify=ssl_verify)
|
72
74
|
|
73
75
|
# Open it up
|
74
76
|
workbook = load_workbook(filename=excel_path)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: warn-scraper
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.85
|
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
|
@@ -43,7 +43,7 @@ warn/scrapers/in.py,sha256=dAT40ROhhKiwLcwa_YJ6EyhsYBLe0IX2rOWXmNa6JMs,2026
|
|
43
43
|
warn/scrapers/ks.py,sha256=F_3biEMF7zgCX2XVuUACR74Vyzapta4SaM9SY3EuZCU,1266
|
44
44
|
warn/scrapers/ky.py,sha256=XjIojMpaoKbypa7l23IybP02jBijBCJG5UGqfO-EYjg,4365
|
45
45
|
warn/scrapers/la.py,sha256=60z-4LZY5xp6aX8r6HGGW3FaOVEGnxlG2Mfgpt4G2WE,12877
|
46
|
-
warn/scrapers/md.py,sha256=
|
46
|
+
warn/scrapers/md.py,sha256=qRnmYsSFTQWeFUN6RJislnrKJ6ky2tqJUHJrmin9C-s,4011
|
47
47
|
warn/scrapers/me.py,sha256=q36F4yJ7hvZsLayA3uBS1romo4X3Qf-sEi2Y7LAQCi8,1172
|
48
48
|
warn/scrapers/mi.py,sha256=9clZ9mATEJwdVLzDo_h66rK0aV5Zc7GGQ7AauutS6Wo,3591
|
49
49
|
warn/scrapers/mo.py,sha256=wnnwQAiVPwuheMqptMXZpyQdiKNghhKwTO-Bnh9oXoU,3492
|
@@ -59,15 +59,15 @@ warn/scrapers/ri.py,sha256=EUyLy59eNiYHqiJR8C0YcJrZtp09KyVc45AFD0_Uc0U,4497
|
|
59
59
|
warn/scrapers/sc.py,sha256=p3kscSNSW9C8C5QaSUbCAo6XibgB7G2iH6zaMH7Mnsc,4819
|
60
60
|
warn/scrapers/sd.py,sha256=_4R19Ybzsyx1PvcWV3_laJmJ3etrwVGfhNEQm6njwoA,1904
|
61
61
|
warn/scrapers/tn.py,sha256=i1H7c09Ea3CDrTXqqRMLBMPT_34QtGA0-x7T8rm_j5Q,2945
|
62
|
-
warn/scrapers/tx.py,sha256=
|
62
|
+
warn/scrapers/tx.py,sha256=watfR1gyN9w7nluiAOnnIghEmoq3eShNUzYSZ8SkZy4,4438
|
63
63
|
warn/scrapers/ut.py,sha256=iUh38YIjbvv5MyyKacsiZNe8KjfdBeDaOf-qMQEF_kc,2245
|
64
64
|
warn/scrapers/va.py,sha256=13lhkQrSkPGHEiWUuf1qiS890PWYE5gV-TgISpoiQnc,1711
|
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.85.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
69
|
+
warn_scraper-1.2.85.dist-info/METADATA,sha256=lpc4ux36Yj-V8oKjLaWvnofk5MD2ZQGdXG-fIAknW1c,2036
|
70
|
+
warn_scraper-1.2.85.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
71
|
+
warn_scraper-1.2.85.dist-info/entry_points.txt,sha256=poh_oSweObGlBSs1_2qZmnTodlOYD0KfO7-h7W2UQIw,47
|
72
|
+
warn_scraper-1.2.85.dist-info/top_level.txt,sha256=gOhHgNEkrUvajlzoKkVOo-TlQht9MoXnKOErjzqLGHo,11
|
73
|
+
warn_scraper-1.2.85.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|