warn-scraper 1.2.156.dev0__tar.gz → 1.2.157.dev0__tar.gz
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_scraper-1.2.156.dev0/warn_scraper.egg-info → warn_scraper-1.2.157.dev0}/PKG-INFO +1 -1
- warn_scraper-1.2.157.dev0/warn/scrapers/al.py +71 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0/warn_scraper.egg-info}/PKG-INFO +1 -1
- warn_scraper-1.2.156.dev0/warn/scrapers/al.py +0 -76
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/.devcontainer/devcontainer.json +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/.github/dependabot-disabled.yml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/.github/workflows/continuous-deployment.yml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/.github/workflows/continuous-deployment.yml.broken-tests +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/.gitignore +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/.pre-commit-config.yaml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/LICENSE +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/MANIFEST.in +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/Makefile +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/Pipfile +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/Pipfile.lock +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/README.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/Makefile +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/R42693.pdf +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/gao-03-1003.pdf +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-actions-finished.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-actions-start.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-changelog-button.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-changelog-entered.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-draft-button.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-name-release.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-name-tag.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-publish-button.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-pypi.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-release-published.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-releases-button.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-tag-button.png +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_templates/sources.md.tmpl +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/conf.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/contributing.rst +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/index.rst +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/make.bat +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/reference.rst +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/releasing.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/requirements.txt +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/al.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/az.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/ca.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/co.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/dc.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/de.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/ia.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/in.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/job_center.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/ks.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/md.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/me.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/mo.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/ny.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/ok.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/or.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/sc.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/tx.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/ut.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/va.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/vt.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/scrapers/wi.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/sources.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/usage.md +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/pyproject.toml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/setup.cfg +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/setup.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/__init__.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_cached_detail_pages.yaml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_cached_search_results.yaml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_missing_detail_page_values.yaml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_no_results.yaml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_paged_results.yaml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_scrape_integration.yaml +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/conftest.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/fixtures/2021_page_1.html +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/fixtures/2021_page_2.html +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/test_cache.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/test_delete.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/test_job_center.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/test_job_center_cache.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/test_openpyxl.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/__init__.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/cache.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/cli.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/pdfrodent/__init__.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/pdfrodent/pdfrodent.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/platforms/__init__.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/platforms/job_center/__init__.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/platforms/job_center/cache.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/platforms/job_center/site.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/platforms/job_center/urls.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/platforms/job_center/utils.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/runner.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/__init__.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ak.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/az.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ca.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/co.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ct.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/dc.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/de.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/fl.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ga.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/hi.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ia.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/id.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/il.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/in.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ks.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ky.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/la.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/md.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/me.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/mi.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/mo.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ms.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/mt.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ne.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/nj.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/nm.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ny.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/oh.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ok.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/or.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/pa.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ri.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/sc.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/sd.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/tn.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/tx.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/ut.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/va.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/vt.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/wa.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/scrapers/wi.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/utils.py +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn_scraper.egg-info/SOURCES.txt +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn_scraper.egg-info/dependency_links.txt +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn_scraper.egg-info/entry_points.txt +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn_scraper.egg-info/requires.txt +0 -0
- {warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn_scraper.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: warn-scraper
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.157.dev0
|
|
4
4
|
Summary: Command-line interface for downloading WARN Act notices of qualified plant closings and mass layoffs from state government websites
|
|
5
5
|
Author-email: Big Local News <biglocalnews@stanford.edu>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import csv
|
|
2
|
+
import logging
|
|
3
|
+
from io import StringIO
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from .. import utils
|
|
7
|
+
from ..cache import Cache
|
|
8
|
+
|
|
9
|
+
__authors__ = ["zstumgoren", "Dilcia19", "stucka"]
|
|
10
|
+
__tags__ = [
|
|
11
|
+
"csv",
|
|
12
|
+
]
|
|
13
|
+
__source__ = {
|
|
14
|
+
"name": "Alabama Department of Commerce",
|
|
15
|
+
"url": "https://www.madeinalabama.com/warn-list/",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def scrape(
|
|
22
|
+
data_dir: Path = utils.WARN_DATA_DIR,
|
|
23
|
+
cache_dir: Path = utils.WARN_CACHE_DIR,
|
|
24
|
+
) -> Path:
|
|
25
|
+
"""
|
|
26
|
+
Scrape data from Alabama.
|
|
27
|
+
|
|
28
|
+
Keyword arguments:
|
|
29
|
+
data_dir -- the Path were the result will be saved (default WARN_DATA_DIR)
|
|
30
|
+
cache_dir -- the Path where results can be cached (default WARN_CACHE_DIR)
|
|
31
|
+
|
|
32
|
+
Returns: the Path where the file is written
|
|
33
|
+
"""
|
|
34
|
+
cache = Cache()
|
|
35
|
+
output_csv = data_dir / "al.csv"
|
|
36
|
+
|
|
37
|
+
# page = utils.get_url("https://www.madeinalabama.com/warn-list/")
|
|
38
|
+
# URL change in June 2026, maybe led to a HTTP 415 error
|
|
39
|
+
# page = utils.get_url("https://workforce.alabama.gov/warn-list/")
|
|
40
|
+
# Later in June 2026, they're detecting the automation and blocking us.
|
|
41
|
+
# But say they won't for the CSV download which, OK.
|
|
42
|
+
# No headers on the CSV, which they'll probably realize ... sometime.
|
|
43
|
+
|
|
44
|
+
targeturl = "https://workforce.alabama.gov/documents/warn-list/"
|
|
45
|
+
page = utils.get_url(targeturl).text
|
|
46
|
+
cache.write("al/rawcsv.csv", page)
|
|
47
|
+
|
|
48
|
+
headers = [
|
|
49
|
+
"_id1",
|
|
50
|
+
"action_type",
|
|
51
|
+
"date_notice",
|
|
52
|
+
"date_action",
|
|
53
|
+
"company",
|
|
54
|
+
"location",
|
|
55
|
+
"affected",
|
|
56
|
+
"_id2",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
fileholder = StringIO(page)
|
|
60
|
+
|
|
61
|
+
reader = list(csv.DictReader(fileholder, fieldnames=headers))
|
|
62
|
+
|
|
63
|
+
utils.write_disparate_dict_rows_to_csv(
|
|
64
|
+
output_csv, reader, mode="w", prefixes=["_id"]
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
return output_csv
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
scrape()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: warn-scraper
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.157.dev0
|
|
4
4
|
Summary: Command-line interface for downloading WARN Act notices of qualified plant closings and mass layoffs from state government websites
|
|
5
5
|
Author-email: Big Local News <biglocalnews@stanford.edu>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import re
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
from bs4 import BeautifulSoup
|
|
6
|
-
|
|
7
|
-
from .. import utils
|
|
8
|
-
|
|
9
|
-
__authors__ = ["zstumgoren", "Dilcia19"]
|
|
10
|
-
__tags__ = [
|
|
11
|
-
"html",
|
|
12
|
-
]
|
|
13
|
-
__source__ = {
|
|
14
|
-
"name": "Alabama Department of Commerce",
|
|
15
|
-
"url": "https://www.madeinalabama.com/warn-list/",
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
logger = logging.getLogger(__name__)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def scrape(
|
|
22
|
-
data_dir: Path = utils.WARN_DATA_DIR,
|
|
23
|
-
cache_dir: Path = utils.WARN_CACHE_DIR,
|
|
24
|
-
) -> Path:
|
|
25
|
-
"""
|
|
26
|
-
Scrape data from Alabama.
|
|
27
|
-
|
|
28
|
-
Keyword arguments:
|
|
29
|
-
data_dir -- the Path were the result will be saved (default WARN_DATA_DIR)
|
|
30
|
-
cache_dir -- the Path where results can be cached (default WARN_CACHE_DIR)
|
|
31
|
-
|
|
32
|
-
Returns: the Path where the file is written
|
|
33
|
-
"""
|
|
34
|
-
output_csv = data_dir / "al.csv"
|
|
35
|
-
# page = utils.get_url("https://www.madeinalabama.com/warn-list/")
|
|
36
|
-
# URL change in June 2026, maybe led to a HTTP 415 error
|
|
37
|
-
page = utils.get_url("https://workforce.alabama.gov/warn-list/")
|
|
38
|
-
|
|
39
|
-
# can't see 2020 listings when I open web page, but they are on the summary in the google search
|
|
40
|
-
soup = BeautifulSoup(page.text, "html.parser")
|
|
41
|
-
table = soup.find_all("table") # output is list-type
|
|
42
|
-
table_rows = table[0].find_all("tr")
|
|
43
|
-
logger.debug(f"{len(table_rows):,} total table rows (including header) found")
|
|
44
|
-
# Handle the header
|
|
45
|
-
raw_header = table_rows.pop(0)
|
|
46
|
-
header_row = _extract_fields_from_row(raw_header, "th")
|
|
47
|
-
output_rows = [header_row]
|
|
48
|
-
# Process remaining rows
|
|
49
|
-
discarded_rows = []
|
|
50
|
-
for table_row in table_rows:
|
|
51
|
-
# Discard bogus data lines (see last lines of source data)
|
|
52
|
-
# based on check of first field ("Closing or Layoff")
|
|
53
|
-
data = _extract_fields_from_row(table_row, "td")
|
|
54
|
-
layoff_type = data[0]
|
|
55
|
-
if re.match(r"(clos|lay)", layoff_type, re.I):
|
|
56
|
-
output_rows.append(data)
|
|
57
|
-
else:
|
|
58
|
-
discarded_rows.append(data)
|
|
59
|
-
if discarded_rows:
|
|
60
|
-
logger.warn(f"Warning: Discarded {len(discarded_rows)} dirty data row(s)")
|
|
61
|
-
utils.write_rows_to_csv(output_csv, output_rows)
|
|
62
|
-
return output_csv
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def _extract_fields_from_row(row, element):
|
|
66
|
-
"""Pluck data from the provided row and element."""
|
|
67
|
-
row_data = []
|
|
68
|
-
fields = row.find_all(element)
|
|
69
|
-
for raw_field in fields:
|
|
70
|
-
field = raw_field.text.strip()
|
|
71
|
-
row_data.append(field)
|
|
72
|
-
return row_data
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if __name__ == "__main__":
|
|
76
|
-
scrape()
|
|
File without changes
|
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/.github/workflows/continuous-deployment.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-actions-finished.png
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-actions-start.png
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-changelog-button.png
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-changelog-entered.png
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-draft-button.png
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-name-release.png
RENAMED
|
File without changes
|
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-publish-button.png
RENAMED
|
File without changes
|
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-release-published.png
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-releases-button.png
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/docs/_static/releasing-tag-button.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_no_results.yaml
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_paged_results.yaml
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/tests/cassettes/test_scrape_integration.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn/platforms/job_center/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn_scraper.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{warn_scraper-1.2.156.dev0 → warn_scraper-1.2.157.dev0}/warn_scraper.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|