milwaukee-restaraunt-parser 0.1.0__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.
- milwaukee_restaraunt_parser-0.1.0/LICENSE.txt +7 -0
- milwaukee_restaraunt_parser-0.1.0/PKG-INFO +49 -0
- milwaukee_restaraunt_parser-0.1.0/README.md +33 -0
- milwaukee_restaraunt_parser-0.1.0/milwaukee_restaraunt_parser/__init__.py +1 -0
- milwaukee_restaraunt_parser-0.1.0/milwaukee_restaraunt_parser/mke_restaraunt_parser.py +89 -0
- milwaukee_restaraunt_parser-0.1.0/milwaukee_restaraunt_parser.egg-info/PKG-INFO +49 -0
- milwaukee_restaraunt_parser-0.1.0/milwaukee_restaraunt_parser.egg-info/SOURCES.txt +10 -0
- milwaukee_restaraunt_parser-0.1.0/milwaukee_restaraunt_parser.egg-info/dependency_links.txt +1 -0
- milwaukee_restaraunt_parser-0.1.0/milwaukee_restaraunt_parser.egg-info/requires.txt +3 -0
- milwaukee_restaraunt_parser-0.1.0/milwaukee_restaraunt_parser.egg-info/top_level.txt +3 -0
- milwaukee_restaraunt_parser-0.1.0/pyproject.toml +26 -0
- milwaukee_restaraunt_parser-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 jasonfry89
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: milwaukee-restaraunt-parser
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Gets Milwaukee restaurant grades
|
|
5
|
+
Author-email: Jason Fry <your.email@example.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Requires-Dist: beautifulsoup4>=4.6.1
|
|
13
|
+
Requires-Dist: aiohttp>=3.6.0
|
|
14
|
+
Requires-Dist: python-dateutil>=2.9.0
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# Milwaukee Restaurant Grade Parser
|
|
18
|
+
|
|
19
|
+
Gets Milwaukee restaurant grades
|
|
20
|
+
|
|
21
|
+
### Installation
|
|
22
|
+
|
|
23
|
+
`python3 -m venv .venv`
|
|
24
|
+
|
|
25
|
+
`source .venv/bin/activate`
|
|
26
|
+
|
|
27
|
+
`pip3 install .`
|
|
28
|
+
|
|
29
|
+
### Run
|
|
30
|
+
|
|
31
|
+
`python mke_restaraunt_parser.py`
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
[MilwaukeeFacilitySearch(facility_id='4202335458016E20862581AA0054068E', name="WY'EAST PIZZA", address='5601 W VLIET ST', sub_type='Retail Food - Serving Meals')]
|
|
35
|
+
MilwaukeeFacilityInformation(facility_id='4202335458016E20862581AA0054068E', name="WY'EAST PIZZA", address='5601 W VLIET ST, MILWAUKEE, WI 53208-2123', score=99, last_inspection_date=datetime.date(2025, 10, 15), status='Permitted')
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Publishing
|
|
39
|
+
|
|
40
|
+
Get API key from [PyPI](https://pypi.org/)
|
|
41
|
+
|
|
42
|
+
`source .venv/bin/activate`
|
|
43
|
+
|
|
44
|
+
`python3 -m pip install --upgrade build twine`
|
|
45
|
+
|
|
46
|
+
`python3 -m build`
|
|
47
|
+
|
|
48
|
+
`python3 -m twine upload dist/*`, using your API key
|
|
49
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Milwaukee Restaurant Grade Parser
|
|
2
|
+
|
|
3
|
+
Gets Milwaukee restaurant grades
|
|
4
|
+
|
|
5
|
+
### Installation
|
|
6
|
+
|
|
7
|
+
`python3 -m venv .venv`
|
|
8
|
+
|
|
9
|
+
`source .venv/bin/activate`
|
|
10
|
+
|
|
11
|
+
`pip3 install .`
|
|
12
|
+
|
|
13
|
+
### Run
|
|
14
|
+
|
|
15
|
+
`python mke_restaraunt_parser.py`
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
[MilwaukeeFacilitySearch(facility_id='4202335458016E20862581AA0054068E', name="WY'EAST PIZZA", address='5601 W VLIET ST', sub_type='Retail Food - Serving Meals')]
|
|
19
|
+
MilwaukeeFacilityInformation(facility_id='4202335458016E20862581AA0054068E', name="WY'EAST PIZZA", address='5601 W VLIET ST, MILWAUKEE, WI 53208-2123', score=99, last_inspection_date=datetime.date(2025, 10, 15), status='Permitted')
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Publishing
|
|
23
|
+
|
|
24
|
+
Get API key from [PyPI](https://pypi.org/)
|
|
25
|
+
|
|
26
|
+
`source .venv/bin/activate`
|
|
27
|
+
|
|
28
|
+
`python3 -m pip install --upgrade build twine`
|
|
29
|
+
|
|
30
|
+
`python3 -m build`
|
|
31
|
+
|
|
32
|
+
`python3 -m twine upload dist/*`, using your API key
|
|
33
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from mke_restaraunt_parser import get_facility, search_facilities, MilwaukeeFacilitySearch, MilwaukeeFacilityInformation
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import logging
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from datetime import date
|
|
5
|
+
from typing import List
|
|
6
|
+
|
|
7
|
+
from dateutil import parser
|
|
8
|
+
import aiohttp
|
|
9
|
+
from bs4 import BeautifulSoup
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class MilwaukeeFacilityInformation:
|
|
14
|
+
facility_id: str
|
|
15
|
+
name: str
|
|
16
|
+
address: str
|
|
17
|
+
score: int | None
|
|
18
|
+
last_inspection_date: date | None
|
|
19
|
+
status: str
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class MilwaukeeFacilitySearch:
|
|
23
|
+
facility_id: str
|
|
24
|
+
name: str
|
|
25
|
+
address: str | None
|
|
26
|
+
sub_type: str | None
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
BASE_URL = "https://healthinspection.healthspace.com/clients/wi/Milwaukee/Web.nsf/"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def get_facility(facility_id: str) -> MilwaukeeFacilityInformation:
|
|
33
|
+
async with aiohttp.ClientSession(base_url=BASE_URL) as session:
|
|
34
|
+
async with session.get(
|
|
35
|
+
f"formFacility.xsp?id={facility_id}&module=Food") as response:
|
|
36
|
+
response.raise_for_status()
|
|
37
|
+
html = await response.text()
|
|
38
|
+
|
|
39
|
+
parsed = BeautifulSoup(html, features="html.parser")
|
|
40
|
+
|
|
41
|
+
name_element = parsed.find("span", id="view:_id1:_id200:nameCF1")
|
|
42
|
+
address_element = parsed.find("span", id="view:_id1:_id200:facilityAddressCF1")
|
|
43
|
+
score_element = parsed.find("span", id="view:_id1:_id200:ScoreCF1")
|
|
44
|
+
last_inspection_date_element = parsed.find("span", id="view:_id1:_id200:lastInspectionCF1")
|
|
45
|
+
status_element = parsed.find("span", id="view:_id1:_id200:statusCF1")
|
|
46
|
+
|
|
47
|
+
return MilwaukeeFacilityInformation(
|
|
48
|
+
facility_id=facility_id,
|
|
49
|
+
name=name_element.text,
|
|
50
|
+
address=address_element.text,
|
|
51
|
+
score=try_parse_int(score_element.text),
|
|
52
|
+
last_inspection_date=try_parse_date(last_inspection_date_element.text),
|
|
53
|
+
status=status_element.text,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
async def search_facilities(search: str) -> List[MilwaukeeFacilitySearch]:
|
|
57
|
+
async with aiohttp.ClientSession(base_url=BASE_URL) as session:
|
|
58
|
+
async with session.get(
|
|
59
|
+
f"restQuery.xsp/searchFacilities?query={search}&maxcount=50&module=Food&viewname=XPagesFacilitiesByType&source=util_searchEstablishments.cc") as response:
|
|
60
|
+
response.raise_for_status()
|
|
61
|
+
search_results = await response.json()
|
|
62
|
+
|
|
63
|
+
return [MilwaukeeFacilitySearch(facility_id=result['unid'], name=result['name'], address=result.get('Address'), sub_type=result.get('SubType')) for result in search_results]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def try_parse_date(value, default=None) -> date | None:
|
|
67
|
+
try:
|
|
68
|
+
return parser.parse(value).date()
|
|
69
|
+
except (ValueError, TypeError):
|
|
70
|
+
return default
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def try_parse_int(value, default=None) -> int | None:
|
|
74
|
+
try:
|
|
75
|
+
return int(value)
|
|
76
|
+
except (ValueError, TypeError):
|
|
77
|
+
return default
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
async def main():
|
|
81
|
+
search_results = await search_facilities("wy'east")
|
|
82
|
+
print(search_results)
|
|
83
|
+
facility = await get_facility(search_results[0].facility_id)
|
|
84
|
+
print(facility)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if __name__ == "__main__":
|
|
88
|
+
logging.basicConfig(level=logging.INFO)
|
|
89
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: milwaukee-restaraunt-parser
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Gets Milwaukee restaurant grades
|
|
5
|
+
Author-email: Jason Fry <your.email@example.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Requires-Dist: beautifulsoup4>=4.6.1
|
|
13
|
+
Requires-Dist: aiohttp>=3.6.0
|
|
14
|
+
Requires-Dist: python-dateutil>=2.9.0
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# Milwaukee Restaurant Grade Parser
|
|
18
|
+
|
|
19
|
+
Gets Milwaukee restaurant grades
|
|
20
|
+
|
|
21
|
+
### Installation
|
|
22
|
+
|
|
23
|
+
`python3 -m venv .venv`
|
|
24
|
+
|
|
25
|
+
`source .venv/bin/activate`
|
|
26
|
+
|
|
27
|
+
`pip3 install .`
|
|
28
|
+
|
|
29
|
+
### Run
|
|
30
|
+
|
|
31
|
+
`python mke_restaraunt_parser.py`
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
[MilwaukeeFacilitySearch(facility_id='4202335458016E20862581AA0054068E', name="WY'EAST PIZZA", address='5601 W VLIET ST', sub_type='Retail Food - Serving Meals')]
|
|
35
|
+
MilwaukeeFacilityInformation(facility_id='4202335458016E20862581AA0054068E', name="WY'EAST PIZZA", address='5601 W VLIET ST, MILWAUKEE, WI 53208-2123', score=99, last_inspection_date=datetime.date(2025, 10, 15), status='Permitted')
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Publishing
|
|
39
|
+
|
|
40
|
+
Get API key from [PyPI](https://pypi.org/)
|
|
41
|
+
|
|
42
|
+
`source .venv/bin/activate`
|
|
43
|
+
|
|
44
|
+
`python3 -m pip install --upgrade build twine`
|
|
45
|
+
|
|
46
|
+
`python3 -m build`
|
|
47
|
+
|
|
48
|
+
`python3 -m twine upload dist/*`, using your API key
|
|
49
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
milwaukee_restaraunt_parser/__init__.py
|
|
5
|
+
milwaukee_restaraunt_parser/mke_restaraunt_parser.py
|
|
6
|
+
milwaukee_restaraunt_parser.egg-info/PKG-INFO
|
|
7
|
+
milwaukee_restaraunt_parser.egg-info/SOURCES.txt
|
|
8
|
+
milwaukee_restaraunt_parser.egg-info/dependency_links.txt
|
|
9
|
+
milwaukee_restaraunt_parser.egg-info/requires.txt
|
|
10
|
+
milwaukee_restaraunt_parser.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "milwaukee-restaraunt-parser"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"beautifulsoup4>=4.6.1",
|
|
10
|
+
"aiohttp>=3.6.0",
|
|
11
|
+
"python-dateutil>=2.9.0",
|
|
12
|
+
]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name="Jason Fry", email="your.email@example.com" },
|
|
15
|
+
]
|
|
16
|
+
description = "Gets Milwaukee restaurant grades"
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
requires-python = ">=3.8"
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.packages.find]
|
|
26
|
+
where = ["."]
|