uk_bin_collection 0.129.0__py3-none-any.whl → 0.130.0__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.
- uk_bin_collection/tests/input.json +6 -0
- uk_bin_collection/uk_bin_collection/councils/HerefordshireCouncil.py +53 -0
- {uk_bin_collection-0.129.0.dist-info → uk_bin_collection-0.130.0.dist-info}/METADATA +1 -1
- {uk_bin_collection-0.129.0.dist-info → uk_bin_collection-0.130.0.dist-info}/RECORD +7 -6
- {uk_bin_collection-0.129.0.dist-info → uk_bin_collection-0.130.0.dist-info}/LICENSE +0 -0
- {uk_bin_collection-0.129.0.dist-info → uk_bin_collection-0.130.0.dist-info}/WHEEL +0 -0
- {uk_bin_collection-0.129.0.dist-info → uk_bin_collection-0.130.0.dist-info}/entry_points.txt +0 -0
| @@ -882,6 +882,12 @@ | |
| 882 882 | 
             
                    "wiki_name": "Hartlepool Borough Council",
         | 
| 883 883 | 
             
                    "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find your UPRN."
         | 
| 884 884 | 
             
                },
         | 
| 885 | 
            +
                "HerefordshireCouncil": {
         | 
| 886 | 
            +
                    "url": "https://www.herefordshire.gov.uk/rubbish-recycling/check-bin-collection-day?blpu_uprn=10096232662",
         | 
| 887 | 
            +
                    "wiki_command_url_override": "https://www.herefordshire.gov.uk/rubbish-recycling/check-bin-collection-day?blpu_uprn=XXXXXXXXXXXX",
         | 
| 888 | 
            +
                    "wiki_name": "Herefordshire Council",
         | 
| 889 | 
            +
                    "wiki_note": "Replace 'XXXXXXXXXX' with your property's UPRN. You can find it using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
         | 
| 890 | 
            +
                },
         | 
| 885 891 | 
             
                "HertsmereBoroughCouncil": {
         | 
| 886 892 | 
             
                    "house_number": "1",
         | 
| 887 893 | 
             
                    "postcode": "WD7 9HZ",
         | 
| @@ -0,0 +1,53 @@ | |
| 1 | 
            +
            import logging
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            from bs4 import BeautifulSoup
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            from uk_bin_collection.uk_bin_collection.common import *
         | 
| 6 | 
            +
            from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            # import the wonderful Beautiful Soup and the URL grabber
         | 
| 10 | 
            +
            class CouncilClass(AbstractGetBinDataClass):
         | 
| 11 | 
            +
                """
         | 
| 12 | 
            +
                Concrete classes have to implement all abstract operations of the
         | 
| 13 | 
            +
                base class. They can also override some operations with a default
         | 
| 14 | 
            +
                implementation.
         | 
| 15 | 
            +
                """
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def parse_data(self, page: str, **kwargs) -> dict:
         | 
| 18 | 
            +
                    # Make a BS4 object
         | 
| 19 | 
            +
                    soup = BeautifulSoup(page.text, features="html.parser")
         | 
| 20 | 
            +
                    soup.prettify()
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    data = {"bins": []}
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    checkValid = soup.find("p", id="selectedAddressResult")
         | 
| 25 | 
            +
                    if checkValid is None:
         | 
| 26 | 
            +
                        raise ValueError("Address/UPRN not found")
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    collections = soup.find("div", id="wasteCollectionDates")
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                    for bins in collections.select('div[class*="hc-island"]'):
         | 
| 31 | 
            +
                        bin_type = bins.h4.get_text(strip=True)
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                        # Last div.hc-island is the calendar link, skip it
         | 
| 34 | 
            +
                        if bin_type == "Calendar":
         | 
| 35 | 
            +
                            continue
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                        # Next collection date is in a span under the second p.hc-no-margin of the div.
         | 
| 38 | 
            +
                        bin_collection = re.search(
         | 
| 39 | 
            +
                            r"(.*) \(.*\)", bins.select("div > p > span")[0].get_text(strip=True)
         | 
| 40 | 
            +
                        ).group(1)
         | 
| 41 | 
            +
                        if bin_collection:
         | 
| 42 | 
            +
                            logging.info(
         | 
| 43 | 
            +
                                f"Bin type: {bin_type} - Collection date: {bin_collection}"
         | 
| 44 | 
            +
                            )
         | 
| 45 | 
            +
                            dict_data = {
         | 
| 46 | 
            +
                                "type": bin_type,
         | 
| 47 | 
            +
                                "collectionDate": datetime.strptime(
         | 
| 48 | 
            +
                                    bin_collection, "%A %d %B %Y"
         | 
| 49 | 
            +
                                ).strftime(date_format),
         | 
| 50 | 
            +
                            }
         | 
| 51 | 
            +
                            data["bins"].append(dict_data)
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    return data
         | 
| @@ -2,7 +2,7 @@ uk_bin_collection/README.rst,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU, | |
| 2 2 | 
             
            uk_bin_collection/tests/council_feature_input_parity.py,sha256=DO6Mk4ImYgM5ZCZ-cutwz5RoYYWZRLYx2tr6zIs_9Rc,3843
         | 
| 3 3 | 
             
            uk_bin_collection/tests/features/environment.py,sha256=VQZjJdJI_kZn08M0j5cUgvKT4k3iTw8icJge1DGOkoA,127
         | 
| 4 4 | 
             
            uk_bin_collection/tests/features/validate_council_outputs.feature,sha256=SJK-Vc737hrf03tssxxbeg_JIvAH-ddB8f6gU1LTbuQ,251
         | 
| 5 | 
            -
            uk_bin_collection/tests/input.json,sha256= | 
| 5 | 
            +
            uk_bin_collection/tests/input.json,sha256=EUx3biB0uK4bYrQEM5YTMa3xXTxKVfb0-mcw8bupyqM,115835
         | 
| 6 6 | 
             
            uk_bin_collection/tests/output.schema,sha256=ZwKQBwYyTDEM4G2hJwfLUVM-5v1vKRvRK9W9SS1sd18,1086
         | 
| 7 7 | 
             
            uk_bin_collection/tests/step_defs/step_helpers/file_handler.py,sha256=Ygzi4V0S1MIHqbdstUlIqtRIwnynvhu4UtpweJ6-5N8,1474
         | 
| 8 8 | 
             
            uk_bin_collection/tests/step_defs/test_validate_council.py,sha256=VZ0a81sioJULD7syAYHjvK_-nT_Rd36tUyzPetSA0gk,3475
         | 
| @@ -129,6 +129,7 @@ uk_bin_collection/uk_bin_collection/councils/HaringeyCouncil.py,sha256=t_6AkAu4w | |
| 129 129 | 
             
            uk_bin_collection/uk_bin_collection/councils/HarrogateBoroughCouncil.py,sha256=_g3fP5Nq-OUjgNrfRf4UEyFKzq0x8QK-4enh5RP1efA,2050
         | 
| 130 130 | 
             
            uk_bin_collection/uk_bin_collection/councils/HartDistrictCouncil.py,sha256=_llxT4JYYlwm20ZtS3fXwtDs6mwJyLTZBP2wBhvEpWk,2342
         | 
| 131 131 | 
             
            uk_bin_collection/uk_bin_collection/councils/HartlepoolBoroughCouncil.py,sha256=MUT1A24iZShT2p55rXEvgYwGUuw3W05Z4ZQAveehv-s,2842
         | 
| 132 | 
            +
            uk_bin_collection/uk_bin_collection/councils/HerefordshireCouncil.py,sha256=JpQhkWM6Jeuzf1W7r0HqvtVnEqNi18nhwJX70YucdsI,1848
         | 
| 132 133 | 
             
            uk_bin_collection/uk_bin_collection/councils/HertsmereBoroughCouncil.py,sha256=-ThSG6NIJP_wf2GmGL7SAvxbOujdhanZ8ECP4VSQCBs,5415
         | 
| 133 134 | 
             
            uk_bin_collection/uk_bin_collection/councils/HighPeakCouncil.py,sha256=x7dfy8mdt2iGl8qJxHb-uBh4u0knmi9MJ6irOJw9WYA,4805
         | 
| 134 135 | 
             
            uk_bin_collection/uk_bin_collection/councils/HighlandCouncil.py,sha256=GNxDU65QuZHV5va2IrKtcJ6TQoDdwmV03JvkVqOauP4,3291
         | 
| @@ -305,8 +306,8 @@ uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bId | |
| 305 306 | 
             
            uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=EQWRhZ2pEejlvm0fPyOTsOHKvUZmPnxEYO_OWRGKTjs,1158
         | 
| 306 307 | 
             
            uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
         | 
| 307 308 | 
             
            uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=YvmHfZqanwrJ8ToGch34x-L-7yPe31nB_x77_Mgl_vo,4545
         | 
| 308 | 
            -
            uk_bin_collection-0. | 
| 309 | 
            -
            uk_bin_collection-0. | 
| 310 | 
            -
            uk_bin_collection-0. | 
| 311 | 
            -
            uk_bin_collection-0. | 
| 312 | 
            -
            uk_bin_collection-0. | 
| 309 | 
            +
            uk_bin_collection-0.130.0.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
         | 
| 310 | 
            +
            uk_bin_collection-0.130.0.dist-info/METADATA,sha256=BnCUzurUgw3yydA2WY7gFgwqUBQ2R3h6HGT5RC4wXEo,19549
         | 
| 311 | 
            +
            uk_bin_collection-0.130.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
         | 
| 312 | 
            +
            uk_bin_collection-0.130.0.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
         | 
| 313 | 
            +
            uk_bin_collection-0.130.0.dist-info/RECORD,,
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        {uk_bin_collection-0.129.0.dist-info → uk_bin_collection-0.130.0.dist-info}/entry_points.txt
    RENAMED
    
    | 
            File without changes
         |