Skip to content

Commit

Permalink
Use house addresses if no street present.
Browse files Browse the repository at this point in the history
  • Loading branch information
btaczala committed Nov 28, 2024
1 parent 061b35a commit bb49ada
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ def all_houses_per_street(regionId: int, streetId: str):
return r.json()['data']


def all_houses_per_city_no_streets(regionId: int, townId: str):
url = "https://gateway.sisms.pl/akun/api/owners/{region}/townAddresses/list?townId={formattedTOWN_ID}"
r = requests.get(url.format(region=regionId, formattedTOWN_ID=townId))

if r.status_code != 200:
return

data = r.json()['data']
return data


def all_street_per_city(regionId: int, cityId: str):
url = "https://gateway.sisms.pl/akun/api/owners/{region}/streets/list?townId={formattedTOWN_ID}"
r = requests.get(url.format(region=regionId, formattedTOWN_ID=cityId))
Expand Down Expand Up @@ -77,8 +88,10 @@ def main():
if streets_json:
print(streets_json)
else:
print("No streets for region {} and cityId {}".format(
print("No streets for region {} and cityId {}. Dumping house addresses".format(
args.region, args.city))
print(all_houses_per_city_no_streets(args.region, args.city))

return

if args.region:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"Gmina Dobra/Grzepnica/Rezydencka": {"regionId": "112",
"formattedId": "32:11:01:2:0774204:42719:32"},
"Gmina Topólka/Bielki": {"regionId": "40",
"formattedId": "02:17:04:3:0880283:00157:1"}
"formattedId": "02:17:04:3:0880283:00157:1"},
"Gmina Topólka/Bielki": {"regionId": "40",
"formattedId": "04:11:07:2:0870362::1"}
}

API_URL = "https://abc.com/search/"
Expand Down
4 changes: 4 additions & 0 deletions doc/source/blisko.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ $ python custom_components/waste_collection_schedule/waste_collection_schedule/s
$ python custom_components/waste_collection_schedule/waste_collection_schedule/service/Blisko_searcher.py --region 112 --city 32:11:01:2:0774204
```
If there is no streets for given city `Blisko_searcher.py` will dump house numbers. Use its id as `formattedId`. ( `04:11:07:2:0870362::1` for example).
3) Dump all houses number for street:
```
Expand Down

0 comments on commit bb49ada

Please sign in to comment.