uk_bin_collection 0.159.3__py3-none-any.whl → 0.160.1__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/uk_bin_collection/councils/NewportCityCouncil.py +0 -189
 - uk_bin_collection/uk_bin_collection/councils/SomersetCouncil.py +0 -189
 - uk_bin_collection/uk_bin_collection/councils/TestValleyBoroughCouncil.py +4 -191
 - {uk_bin_collection-0.159.3.dist-info → uk_bin_collection-0.160.1.dist-info}/METADATA +1 -1
 - {uk_bin_collection-0.159.3.dist-info → uk_bin_collection-0.160.1.dist-info}/RECORD +8 -8
 - {uk_bin_collection-0.159.3.dist-info → uk_bin_collection-0.160.1.dist-info}/LICENSE +0 -0
 - {uk_bin_collection-0.159.3.dist-info → uk_bin_collection-0.160.1.dist-info}/WHEEL +0 -0
 - {uk_bin_collection-0.159.3.dist-info → uk_bin_collection-0.160.1.dist-info}/entry_points.txt +0 -0
 
| 
         @@ -18,197 +18,8 @@ class CouncilClass(AbstractGetBinDataClass): 
     | 
|
| 
       18 
18 
     | 
    
         
             
                """
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                def parse_data(self, page: str, **kwargs) -> dict:
         
     | 
| 
       21 
     | 
    
         
            -
            <<<<<<< HEAD
         
     | 
| 
       22 
     | 
    
         
            -
                    user_postcode = kwargs.get("postcode")
         
     | 
| 
       23 
     | 
    
         
            -
                    check_postcode(user_postcode)
         
     | 
| 
       24 
     | 
    
         
            -
                    user_uprn = kwargs.get("uprn")
         
     | 
| 
       25 
     | 
    
         
            -
                    check_uprn(user_uprn)
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    headers = {
         
     | 
| 
       28 
     | 
    
         
            -
                        "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) "
         
     | 
| 
       29 
     | 
    
         
            -
                        "Chrome/87.0.4280.141 Safari/537.36"
         
     | 
| 
       30 
     | 
    
         
            -
                    }
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                    requests.packages.urllib3.disable_warnings()
         
     | 
| 
       33 
     | 
    
         
            -
                    with requests.Session() as s:
         
     | 
| 
       34 
     | 
    
         
            -
                        # Set Headers
         
     | 
| 
       35 
     | 
    
         
            -
                        s.headers = headers
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                        # Get the first page - This is the Search for property by Post Code page
         
     | 
| 
       38 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       39 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/f?p=customer:BIN_DAYS:::NO:RP:UID:6CDD2A34C912312074D8E2410531401A8C00EFF7"
         
     | 
| 
       40 
     | 
    
         
            -
                        )
         
     | 
| 
       41 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       42 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                        # The page contains a number of values that must be passed into subsequent requests - extract them here
         
     | 
| 
       45 
     | 
    
         
            -
                        payload = {
         
     | 
| 
       46 
     | 
    
         
            -
                            i["name"]: i.get("value", "") for i in soup.select("input[name]")
         
     | 
| 
       47 
     | 
    
         
            -
                        }
         
     | 
| 
       48 
     | 
    
         
            -
                        payload2 = {
         
     | 
| 
       49 
     | 
    
         
            -
                            i["data-for"]: i.get("value", "")
         
     | 
| 
       50 
     | 
    
         
            -
                            for i in soup.select("input[data-for]")
         
     | 
| 
       51 
     | 
    
         
            -
                        }
         
     | 
| 
       52 
     | 
    
         
            -
                        
         
     | 
| 
       53 
     | 
    
         
            -
                        # Check if required form elements exist
         
     | 
| 
       54 
     | 
    
         
            -
                        salt_element = soup.select_one('input[id="pSalt"]')
         
     | 
| 
       55 
     | 
    
         
            -
                        protected_element = soup.select_one('input[id="pPageItemsProtected"]')
         
     | 
| 
       56 
     | 
    
         
            -
                        
         
     | 
| 
       57 
     | 
    
         
            -
                        if not salt_element or not protected_element:
         
     | 
| 
       58 
     | 
    
         
            -
                            raise Exception("Required form elements not found. The council website may have changed or be unavailable.")
         
     | 
| 
       59 
     | 
    
         
            -
                        
         
     | 
| 
       60 
     | 
    
         
            -
                        payload_salt = salt_element.get("value")
         
     | 
| 
       61 
     | 
    
         
            -
                        payload_protected = protected_element.get("value")
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                        # Add the PostCode and 'SEARCH' to the payload
         
     | 
| 
       64 
     | 
    
         
            -
                        payload["p_request"] = "SEARCH"
         
     | 
| 
       65 
     | 
    
         
            -
                        payload["P153_POST_CODE"] = user_postcode
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                        # Manipulate the lists and build the JSON that must be submitted in further requests - some data is nested
         
     | 
| 
       68 
     | 
    
         
            -
                        merged_list = {**payload, **payload2}
         
     | 
| 
       69 
     | 
    
         
            -
                        new_list = []
         
     | 
| 
       70 
     | 
    
         
            -
                        other_list = {}
         
     | 
| 
       71 
     | 
    
         
            -
                        for key in merged_list.keys():
         
     | 
| 
       72 
     | 
    
         
            -
                            temp_list = {}
         
     | 
| 
       73 
     | 
    
         
            -
                            val = merged_list[key]
         
     | 
| 
       74 
     | 
    
         
            -
                            if key in [
         
     | 
| 
       75 
     | 
    
         
            -
                                "P153_UPRN",
         
     | 
| 
       76 
     | 
    
         
            -
                                "P153_TEMP",
         
     | 
| 
       77 
     | 
    
         
            -
                                "P153_SYSDATE",
         
     | 
| 
       78 
     | 
    
         
            -
                                "P0_LANGUAGE",
         
     | 
| 
       79 
     | 
    
         
            -
                                "P153_POST_CODE",
         
     | 
| 
       80 
     | 
    
         
            -
                            ]:
         
     | 
| 
       81 
     | 
    
         
            -
                                temp_list = {"n": key, "v": val}
         
     | 
| 
       82 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       83 
     | 
    
         
            -
                            elif key in [
         
     | 
| 
       84 
     | 
    
         
            -
                                "p_flow_id",
         
     | 
| 
       85 
     | 
    
         
            -
                                "p_flow_step_id",
         
     | 
| 
       86 
     | 
    
         
            -
                                "p_instance",
         
     | 
| 
       87 
     | 
    
         
            -
                                "p_page_submission_id",
         
     | 
| 
       88 
     | 
    
         
            -
                                "p_request",
         
     | 
| 
       89 
     | 
    
         
            -
                                "p_reload_on_submit",
         
     | 
| 
       90 
     | 
    
         
            -
                            ]:
         
     | 
| 
       91 
     | 
    
         
            -
                                other_list[key] = val
         
     | 
| 
       92 
     | 
    
         
            -
                            else:
         
     | 
| 
       93 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "", "ck": val}
         
     | 
| 
       94 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                        json_builder = {
         
     | 
| 
       97 
     | 
    
         
            -
                            "pageItems": {
         
     | 
| 
       98 
     | 
    
         
            -
                                "itemsToSubmit": new_list,
         
     | 
| 
       99 
     | 
    
         
            -
                                "protected": payload_protected,
         
     | 
| 
       100 
     | 
    
         
            -
                                "rowVersion": "",
         
     | 
| 
       101 
     | 
    
         
            -
                                "formRegionChecksums": [],
         
     | 
| 
       102 
     | 
    
         
            -
                            },
         
     | 
| 
       103 
     | 
    
         
            -
                            "salt": payload_salt,
         
     | 
| 
       104 
     | 
    
         
            -
                        }
         
     | 
| 
       105 
     | 
    
         
            -
                        json_object = json.dumps(json_builder, separators=(",", ":"))
         
     | 
| 
       106 
     | 
    
         
            -
                        other_list["p_json"] = json_object
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                        # Set Referrer header
         
     | 
| 
       109 
     | 
    
         
            -
                        s.headers.update(
         
     | 
| 
       110 
     | 
    
         
            -
                            {
         
     | 
| 
       111 
     | 
    
         
            -
                                "referer": "https://iweb.itouchvision.com/portal/f?p=customer:BIN_DAYS:::NO:RP:UID:6CDD2A34C912312074D8E2410531401A8C00EFF7"
         
     | 
| 
       112 
     | 
    
         
            -
                            }
         
     | 
| 
       113 
     | 
    
         
            -
                        )
         
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
                        # Generate POST including all the JSON we just built
         
     | 
| 
       116 
     | 
    
         
            -
                        s.post(
         
     | 
| 
       117 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/wwv_flow.accept", data=other_list
         
     | 
| 
       118 
     | 
    
         
            -
                        )
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                        # The second page on the portal would normally allow you to select your property from a dropdown list of
         
     | 
| 
       121 
     | 
    
         
            -
                        # those that are at the postcode entered on the previous page
         
     | 
| 
       122 
     | 
    
         
            -
                        # The required cookies are stored within the session so re-use the session to keep them
         
     | 
| 
       123 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       124 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/itouchvision/r/customer/bin_days"
         
     | 
| 
       125 
     | 
    
         
            -
                        )
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       128 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
                        # The page contains a number of values that must be passed into subsequent requests - extract them here
         
     | 
| 
       131 
     | 
    
         
            -
                        payload = {
         
     | 
| 
       132 
     | 
    
         
            -
                            i["name"]: i.get("value", "") for i in soup.select("input[name]")
         
     | 
| 
       133 
     | 
    
         
            -
                        }
         
     | 
| 
       134 
     | 
    
         
            -
                        payload2 = {
         
     | 
| 
       135 
     | 
    
         
            -
                            i["data-for"]: i.get("value", "")
         
     | 
| 
       136 
     | 
    
         
            -
                            for i in soup.select("input[data-for]")
         
     | 
| 
       137 
     | 
    
         
            -
                        }
         
     | 
| 
       138 
     | 
    
         
            -
                        
         
     | 
| 
       139 
     | 
    
         
            -
                        # Check if required form elements exist
         
     | 
| 
       140 
     | 
    
         
            -
                        salt_element = soup.select_one('input[id="pSalt"]')
         
     | 
| 
       141 
     | 
    
         
            -
                        protected_element = soup.select_one('input[id="pPageItemsProtected"]')
         
     | 
| 
       142 
     | 
    
         
            -
                        
         
     | 
| 
       143 
     | 
    
         
            -
                        if not salt_element or not protected_element:
         
     | 
| 
       144 
     | 
    
         
            -
                            raise Exception("Required form elements not found. The council website may have changed or be unavailable.")
         
     | 
| 
       145 
     | 
    
         
            -
                        
         
     | 
| 
       146 
     | 
    
         
            -
                        payload_salt = salt_element.get("value")
         
     | 
| 
       147 
     | 
    
         
            -
                        payload_protected = protected_element.get("value")
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                        # Add the UPRN and 'SUBMIT' to the payload
         
     | 
| 
       150 
     | 
    
         
            -
                        payload["p_request"] = "SUBMIT"
         
     | 
| 
       151 
     | 
    
         
            -
                        payload["P153_UPRN"] = user_uprn
         
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                        # Manipulate the lists and build the JSON that must be submitted in further requests - some data is nested
         
     | 
| 
       154 
     | 
    
         
            -
                        merged_list = {**payload, **payload2}
         
     | 
| 
       155 
     | 
    
         
            -
                        new_list = []
         
     | 
| 
       156 
     | 
    
         
            -
                        other_list = {}
         
     | 
| 
       157 
     | 
    
         
            -
                        for key in merged_list.keys():
         
     | 
| 
       158 
     | 
    
         
            -
                            temp_list = {}
         
     | 
| 
       159 
     | 
    
         
            -
                            val = merged_list[key]
         
     | 
| 
       160 
     | 
    
         
            -
                            if key in ["P153_UPRN", "P153_TEMP", "P153_SYSDATE", "P0_LANGUAGE"]:
         
     | 
| 
       161 
     | 
    
         
            -
                                temp_list = {"n": key, "v": val}
         
     | 
| 
       162 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       163 
     | 
    
         
            -
                            elif key in ["P153_ZABY"]:
         
     | 
| 
       164 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "1", "ck": val}
         
     | 
| 
       165 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       166 
     | 
    
         
            -
                            elif key in ["P153_POST_CODE"]:
         
     | 
| 
       167 
     | 
    
         
            -
                                temp_list = {"n": key, "v": user_postcode, "ck": val}
         
     | 
| 
       168 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       169 
     | 
    
         
            -
                            elif key in [
         
     | 
| 
       170 
     | 
    
         
            -
                                "p_flow_id",
         
     | 
| 
       171 
     | 
    
         
            -
                                "p_flow_step_id",
         
     | 
| 
       172 
     | 
    
         
            -
                                "p_instance",
         
     | 
| 
       173 
     | 
    
         
            -
                                "p_page_submission_id",
         
     | 
| 
       174 
     | 
    
         
            -
                                "p_request",
         
     | 
| 
       175 
     | 
    
         
            -
                                "p_reload_on_submit",
         
     | 
| 
       176 
     | 
    
         
            -
                            ]:
         
     | 
| 
       177 
     | 
    
         
            -
                                other_list[key] = val
         
     | 
| 
       178 
     | 
    
         
            -
                            else:
         
     | 
| 
       179 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "", "ck": val}
         
     | 
| 
       180 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                        json_builder = {
         
     | 
| 
       183 
     | 
    
         
            -
                            "pageItems": {
         
     | 
| 
       184 
     | 
    
         
            -
                                "itemsToSubmit": new_list,
         
     | 
| 
       185 
     | 
    
         
            -
                                "protected": payload_protected,
         
     | 
| 
       186 
     | 
    
         
            -
                                "rowVersion": "",
         
     | 
| 
       187 
     | 
    
         
            -
                                "formRegionChecksums": [],
         
     | 
| 
       188 
     | 
    
         
            -
                            },
         
     | 
| 
       189 
     | 
    
         
            -
                            "salt": payload_salt,
         
     | 
| 
       190 
     | 
    
         
            -
                        }
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
                        json_object = json.dumps(json_builder, separators=(",", ":"))
         
     | 
| 
       193 
     | 
    
         
            -
                        other_list["p_json"] = json_object
         
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
                        # Generate POST including all the JSON we just built
         
     | 
| 
       196 
     | 
    
         
            -
                        s.post(
         
     | 
| 
       197 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/wwv_flow.accept", data=other_list
         
     | 
| 
       198 
     | 
    
         
            -
                        )
         
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
                        # The third and final page on the portal shows the detail of the waste collection services
         
     | 
| 
       201 
     | 
    
         
            -
                        # The required cookies are stored within the session so re-use the session to keep them
         
     | 
| 
       202 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       203 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/itouchvision/r/customer/bin_days"
         
     | 
| 
       204 
     | 
    
         
            -
                        )
         
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       207 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       208 
     | 
    
         
            -
            =======
         
     | 
| 
       209 
21 
     | 
    
         
             
                    driver = None
         
     | 
| 
       210 
22 
     | 
    
         
             
                    try:
         
     | 
| 
       211 
     | 
    
         
            -
            >>>>>>> master
         
     | 
| 
       212 
23 
     | 
    
         
             
                        data = {"bins": []}
         
     | 
| 
       213 
24 
     | 
    
         
             
                        url = kwargs.get("url")
         
     | 
| 
       214 
25 
     | 
    
         
             
                        user_paon = kwargs.get("paon")
         
     | 
| 
         @@ -18,197 +18,8 @@ class CouncilClass(AbstractGetBinDataClass): 
     | 
|
| 
       18 
18 
     | 
    
         
             
                """
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                def parse_data(self, page: str, **kwargs) -> dict:
         
     | 
| 
       21 
     | 
    
         
            -
            <<<<<<< HEAD
         
     | 
| 
       22 
     | 
    
         
            -
                    user_postcode = kwargs.get("postcode")
         
     | 
| 
       23 
     | 
    
         
            -
                    check_postcode(user_postcode)
         
     | 
| 
       24 
     | 
    
         
            -
                    user_uprn = kwargs.get("uprn")
         
     | 
| 
       25 
     | 
    
         
            -
                    check_uprn(user_uprn)
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    headers = {
         
     | 
| 
       28 
     | 
    
         
            -
                        "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) "
         
     | 
| 
       29 
     | 
    
         
            -
                        "Chrome/87.0.4280.141 Safari/537.36"
         
     | 
| 
       30 
     | 
    
         
            -
                    }
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                    requests.packages.urllib3.disable_warnings()
         
     | 
| 
       33 
     | 
    
         
            -
                    with requests.Session() as s:
         
     | 
| 
       34 
     | 
    
         
            -
                        # Set Headers
         
     | 
| 
       35 
     | 
    
         
            -
                        s.headers = headers
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                        # Get the first page - This is the Search for property by Post Code page
         
     | 
| 
       38 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       39 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/f?p=customer:BIN_DAYS:::NO:RP:UID:625C791B4D9301137723E9095361401AE8C03934"
         
     | 
| 
       40 
     | 
    
         
            -
                        )
         
     | 
| 
       41 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       42 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                        # The page contains a number of values that must be passed into subsequent requests - extract them here
         
     | 
| 
       45 
     | 
    
         
            -
                        payload = {
         
     | 
| 
       46 
     | 
    
         
            -
                            i["name"]: i.get("value", "") for i in soup.select("input[name]")
         
     | 
| 
       47 
     | 
    
         
            -
                        }
         
     | 
| 
       48 
     | 
    
         
            -
                        payload2 = {
         
     | 
| 
       49 
     | 
    
         
            -
                            i["data-for"]: i.get("value", "")
         
     | 
| 
       50 
     | 
    
         
            -
                            for i in soup.select("input[data-for]")
         
     | 
| 
       51 
     | 
    
         
            -
                        }
         
     | 
| 
       52 
     | 
    
         
            -
                        
         
     | 
| 
       53 
     | 
    
         
            -
                        # Check if required form elements exist
         
     | 
| 
       54 
     | 
    
         
            -
                        salt_element = soup.select_one('input[id="pSalt"]')
         
     | 
| 
       55 
     | 
    
         
            -
                        protected_element = soup.select_one('input[id="pPageItemsProtected"]')
         
     | 
| 
       56 
     | 
    
         
            -
                        
         
     | 
| 
       57 
     | 
    
         
            -
                        if not salt_element or not protected_element:
         
     | 
| 
       58 
     | 
    
         
            -
                            raise Exception("Required form elements not found. The council website may have changed or be unavailable.")
         
     | 
| 
       59 
     | 
    
         
            -
                        
         
     | 
| 
       60 
     | 
    
         
            -
                        payload_salt = salt_element.get("value")
         
     | 
| 
       61 
     | 
    
         
            -
                        payload_protected = protected_element.get("value")
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                        # Add the PostCode and 'SEARCH' to the payload
         
     | 
| 
       64 
     | 
    
         
            -
                        payload["p_request"] = "SEARCH"
         
     | 
| 
       65 
     | 
    
         
            -
                        payload["P153_POST_CODE"] = user_postcode
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                        # Manipulate the lists and build the JSON that must be submitted in further requests - some data is nested
         
     | 
| 
       68 
     | 
    
         
            -
                        merged_list = {**payload, **payload2}
         
     | 
| 
       69 
     | 
    
         
            -
                        new_list = []
         
     | 
| 
       70 
     | 
    
         
            -
                        other_list = {}
         
     | 
| 
       71 
     | 
    
         
            -
                        for key in merged_list.keys():
         
     | 
| 
       72 
     | 
    
         
            -
                            temp_list = {}
         
     | 
| 
       73 
     | 
    
         
            -
                            val = merged_list[key]
         
     | 
| 
       74 
     | 
    
         
            -
                            if key in [
         
     | 
| 
       75 
     | 
    
         
            -
                                "P153_UPRN",
         
     | 
| 
       76 
     | 
    
         
            -
                                "P153_TEMP",
         
     | 
| 
       77 
     | 
    
         
            -
                                "P153_SYSDATE",
         
     | 
| 
       78 
     | 
    
         
            -
                                "P0_LANGUAGE",
         
     | 
| 
       79 
     | 
    
         
            -
                                "P153_POST_CODE",
         
     | 
| 
       80 
     | 
    
         
            -
                            ]:
         
     | 
| 
       81 
     | 
    
         
            -
                                temp_list = {"n": key, "v": val}
         
     | 
| 
       82 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       83 
     | 
    
         
            -
                            elif key in [
         
     | 
| 
       84 
     | 
    
         
            -
                                "p_flow_id",
         
     | 
| 
       85 
     | 
    
         
            -
                                "p_flow_step_id",
         
     | 
| 
       86 
     | 
    
         
            -
                                "p_instance",
         
     | 
| 
       87 
     | 
    
         
            -
                                "p_page_submission_id",
         
     | 
| 
       88 
     | 
    
         
            -
                                "p_request",
         
     | 
| 
       89 
     | 
    
         
            -
                                "p_reload_on_submit",
         
     | 
| 
       90 
     | 
    
         
            -
                            ]:
         
     | 
| 
       91 
     | 
    
         
            -
                                other_list[key] = val
         
     | 
| 
       92 
     | 
    
         
            -
                            else:
         
     | 
| 
       93 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "", "ck": val}
         
     | 
| 
       94 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                        json_builder = {
         
     | 
| 
       97 
     | 
    
         
            -
                            "pageItems": {
         
     | 
| 
       98 
     | 
    
         
            -
                                "itemsToSubmit": new_list,
         
     | 
| 
       99 
     | 
    
         
            -
                                "protected": payload_protected,
         
     | 
| 
       100 
     | 
    
         
            -
                                "rowVersion": "",
         
     | 
| 
       101 
     | 
    
         
            -
                                "formRegionChecksums": [],
         
     | 
| 
       102 
     | 
    
         
            -
                            },
         
     | 
| 
       103 
     | 
    
         
            -
                            "salt": payload_salt,
         
     | 
| 
       104 
     | 
    
         
            -
                        }
         
     | 
| 
       105 
     | 
    
         
            -
                        json_object = json.dumps(json_builder, separators=(",", ":"))
         
     | 
| 
       106 
     | 
    
         
            -
                        other_list["p_json"] = json_object
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                        # Set Referrer header
         
     | 
| 
       109 
     | 
    
         
            -
                        s.headers.update(
         
     | 
| 
       110 
     | 
    
         
            -
                            {
         
     | 
| 
       111 
     | 
    
         
            -
                                "referer": "https://iweb.itouchvision.com/portal/f?p=customer:BIN_DAYS:::NO:RP:UID:625C791B4D9301137723E9095361401AE8C03934"
         
     | 
| 
       112 
     | 
    
         
            -
                            }
         
     | 
| 
       113 
     | 
    
         
            -
                        )
         
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
                        # Generate POST including all the JSON we just built
         
     | 
| 
       116 
     | 
    
         
            -
                        s.post(
         
     | 
| 
       117 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/wwv_flow.accept", data=other_list
         
     | 
| 
       118 
     | 
    
         
            -
                        )
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                        # The second page on the portal would normally allow you to select your property from a dropdown list of
         
     | 
| 
       121 
     | 
    
         
            -
                        # those that are at the postcode entered on the previous page
         
     | 
| 
       122 
     | 
    
         
            -
                        # The required cookies are stored within the session so re-use the session to keep them
         
     | 
| 
       123 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       124 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/itouchvision/r/customer/bin_days"
         
     | 
| 
       125 
     | 
    
         
            -
                        )
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       128 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
                        # The page contains a number of values that must be passed into subsequent requests - extract them here
         
     | 
| 
       131 
     | 
    
         
            -
                        payload = {
         
     | 
| 
       132 
     | 
    
         
            -
                            i["name"]: i.get("value", "") for i in soup.select("input[name]")
         
     | 
| 
       133 
     | 
    
         
            -
                        }
         
     | 
| 
       134 
     | 
    
         
            -
                        payload2 = {
         
     | 
| 
       135 
     | 
    
         
            -
                            i["data-for"]: i.get("value", "")
         
     | 
| 
       136 
     | 
    
         
            -
                            for i in soup.select("input[data-for]")
         
     | 
| 
       137 
     | 
    
         
            -
                        }
         
     | 
| 
       138 
     | 
    
         
            -
                        
         
     | 
| 
       139 
     | 
    
         
            -
                        # Check if required form elements exist
         
     | 
| 
       140 
     | 
    
         
            -
                        salt_element = soup.select_one('input[id="pSalt"]')
         
     | 
| 
       141 
     | 
    
         
            -
                        protected_element = soup.select_one('input[id="pPageItemsProtected"]')
         
     | 
| 
       142 
     | 
    
         
            -
                        
         
     | 
| 
       143 
     | 
    
         
            -
                        if not salt_element or not protected_element:
         
     | 
| 
       144 
     | 
    
         
            -
                            raise Exception("Required form elements not found. The council website may have changed or be unavailable.")
         
     | 
| 
       145 
     | 
    
         
            -
                        
         
     | 
| 
       146 
     | 
    
         
            -
                        payload_salt = salt_element.get("value")
         
     | 
| 
       147 
     | 
    
         
            -
                        payload_protected = protected_element.get("value")
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                        # Add the UPRN and 'SUBMIT' to the payload
         
     | 
| 
       150 
     | 
    
         
            -
                        payload["p_request"] = "SUBMIT"
         
     | 
| 
       151 
     | 
    
         
            -
                        payload["P153_UPRN"] = user_uprn
         
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                        # Manipulate the lists and build the JSON that must be submitted in further requests - some data is nested
         
     | 
| 
       154 
     | 
    
         
            -
                        merged_list = {**payload, **payload2}
         
     | 
| 
       155 
     | 
    
         
            -
                        new_list = []
         
     | 
| 
       156 
     | 
    
         
            -
                        other_list = {}
         
     | 
| 
       157 
     | 
    
         
            -
                        for key in merged_list.keys():
         
     | 
| 
       158 
     | 
    
         
            -
                            temp_list = {}
         
     | 
| 
       159 
     | 
    
         
            -
                            val = merged_list[key]
         
     | 
| 
       160 
     | 
    
         
            -
                            if key in ["P153_UPRN", "P153_TEMP", "P153_SYSDATE", "P0_LANGUAGE"]:
         
     | 
| 
       161 
     | 
    
         
            -
                                temp_list = {"n": key, "v": val}
         
     | 
| 
       162 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       163 
     | 
    
         
            -
                            elif key in ["P153_ZABY"]:
         
     | 
| 
       164 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "1", "ck": val}
         
     | 
| 
       165 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       166 
     | 
    
         
            -
                            elif key in ["P153_POST_CODE"]:
         
     | 
| 
       167 
     | 
    
         
            -
                                temp_list = {"n": key, "v": user_postcode, "ck": val}
         
     | 
| 
       168 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       169 
     | 
    
         
            -
                            elif key in [
         
     | 
| 
       170 
     | 
    
         
            -
                                "p_flow_id",
         
     | 
| 
       171 
     | 
    
         
            -
                                "p_flow_step_id",
         
     | 
| 
       172 
     | 
    
         
            -
                                "p_instance",
         
     | 
| 
       173 
     | 
    
         
            -
                                "p_page_submission_id",
         
     | 
| 
       174 
     | 
    
         
            -
                                "p_request",
         
     | 
| 
       175 
     | 
    
         
            -
                                "p_reload_on_submit",
         
     | 
| 
       176 
     | 
    
         
            -
                            ]:
         
     | 
| 
       177 
     | 
    
         
            -
                                other_list[key] = val
         
     | 
| 
       178 
     | 
    
         
            -
                            else:
         
     | 
| 
       179 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "", "ck": val}
         
     | 
| 
       180 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                        json_builder = {
         
     | 
| 
       183 
     | 
    
         
            -
                            "pageItems": {
         
     | 
| 
       184 
     | 
    
         
            -
                                "itemsToSubmit": new_list,
         
     | 
| 
       185 
     | 
    
         
            -
                                "protected": payload_protected,
         
     | 
| 
       186 
     | 
    
         
            -
                                "rowVersion": "",
         
     | 
| 
       187 
     | 
    
         
            -
                                "formRegionChecksums": [],
         
     | 
| 
       188 
     | 
    
         
            -
                            },
         
     | 
| 
       189 
     | 
    
         
            -
                            "salt": payload_salt,
         
     | 
| 
       190 
     | 
    
         
            -
                        }
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
                        json_object = json.dumps(json_builder, separators=(",", ":"))
         
     | 
| 
       193 
     | 
    
         
            -
                        other_list["p_json"] = json_object
         
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
                        # Generate POST including all the JSON we just built
         
     | 
| 
       196 
     | 
    
         
            -
                        s.post(
         
     | 
| 
       197 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/wwv_flow.accept", data=other_list
         
     | 
| 
       198 
     | 
    
         
            -
                        )
         
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
                        # The third and final page on the portal shows the detail of the waste collection services
         
     | 
| 
       201 
     | 
    
         
            -
                        # The required cookies are stored within the session so re-use the session to keep them
         
     | 
| 
       202 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       203 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/itouchvision/r/customer/bin_days"
         
     | 
| 
       204 
     | 
    
         
            -
                        )
         
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       207 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       208 
     | 
    
         
            -
            =======
         
     | 
| 
       209 
21 
     | 
    
         
             
                    driver = None
         
     | 
| 
       210 
22 
     | 
    
         
             
                    try:
         
     | 
| 
       211 
     | 
    
         
            -
            >>>>>>> master
         
     | 
| 
       212 
23 
     | 
    
         
             
                        data = {"bins": []}
         
     | 
| 
       213 
24 
     | 
    
         
             
                        url = kwargs.get("url")
         
     | 
| 
       214 
25 
     | 
    
         
             
                        user_paon = kwargs.get("paon")
         
     | 
| 
         @@ -18,197 +18,8 @@ class CouncilClass(AbstractGetBinDataClass): 
     | 
|
| 
       18 
18 
     | 
    
         
             
                """
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                def parse_data(self, page: str, **kwargs) -> dict:
         
     | 
| 
       21 
     | 
    
         
            -
            <<<<<<< HEAD
         
     | 
| 
       22 
     | 
    
         
            -
                    user_postcode = kwargs.get("postcode")
         
     | 
| 
       23 
     | 
    
         
            -
                    check_postcode(user_postcode)
         
     | 
| 
       24 
     | 
    
         
            -
                    user_uprn = kwargs.get("uprn")
         
     | 
| 
       25 
     | 
    
         
            -
                    check_uprn(user_uprn)
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    headers = {
         
     | 
| 
       28 
     | 
    
         
            -
                        "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) "
         
     | 
| 
       29 
     | 
    
         
            -
                        "Chrome/87.0.4280.141 Safari/537.36"
         
     | 
| 
       30 
     | 
    
         
            -
                    }
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                    requests.packages.urllib3.disable_warnings()
         
     | 
| 
       33 
     | 
    
         
            -
                    with requests.Session() as s:
         
     | 
| 
       34 
     | 
    
         
            -
                        # Set Headers
         
     | 
| 
       35 
     | 
    
         
            -
                        s.headers = headers
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                        # Get the first page - This is the Search for property by Post Code page
         
     | 
| 
       38 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       39 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/f?p=customer:BIN_DAYS:::NO:RP:UID:13353F039C4B1454827EE05536414091A8C058F4"
         
     | 
| 
       40 
     | 
    
         
            -
                        )
         
     | 
| 
       41 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       42 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                        # The page contains a number of values that must be passed into subsequent requests - extract them here
         
     | 
| 
       45 
     | 
    
         
            -
                        payload = {
         
     | 
| 
       46 
     | 
    
         
            -
                            i["name"]: i.get("value", "") for i in soup.select("input[name]")
         
     | 
| 
       47 
     | 
    
         
            -
                        }
         
     | 
| 
       48 
     | 
    
         
            -
                        payload2 = {
         
     | 
| 
       49 
     | 
    
         
            -
                            i["data-for"]: i.get("value", "")
         
     | 
| 
       50 
     | 
    
         
            -
                            for i in soup.select("input[data-for]")
         
     | 
| 
       51 
     | 
    
         
            -
                        }
         
     | 
| 
       52 
     | 
    
         
            -
                        
         
     | 
| 
       53 
     | 
    
         
            -
                        # Check if required form elements exist
         
     | 
| 
       54 
     | 
    
         
            -
                        salt_element = soup.select_one('input[id="pSalt"]')
         
     | 
| 
       55 
     | 
    
         
            -
                        protected_element = soup.select_one('input[id="pPageItemsProtected"]')
         
     | 
| 
       56 
     | 
    
         
            -
                        
         
     | 
| 
       57 
     | 
    
         
            -
                        if not salt_element or not protected_element:
         
     | 
| 
       58 
     | 
    
         
            -
                            raise Exception("Required form elements not found. The council website may have changed or be unavailable.")
         
     | 
| 
       59 
     | 
    
         
            -
                        
         
     | 
| 
       60 
     | 
    
         
            -
                        payload_salt = salt_element.get("value")
         
     | 
| 
       61 
     | 
    
         
            -
                        payload_protected = protected_element.get("value")
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                        # Add the PostCode and 'SEARCH' to the payload
         
     | 
| 
       64 
     | 
    
         
            -
                        payload["p_request"] = "SEARCH"
         
     | 
| 
       65 
     | 
    
         
            -
                        payload["P153_POST_CODE"] = user_postcode
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                        # Manipulate the lists and build the JSON that must be submitted in further requests - some data is nested
         
     | 
| 
       68 
     | 
    
         
            -
                        merged_list = {**payload, **payload2}
         
     | 
| 
       69 
     | 
    
         
            -
                        new_list = []
         
     | 
| 
       70 
     | 
    
         
            -
                        other_list = {}
         
     | 
| 
       71 
     | 
    
         
            -
                        for key in merged_list.keys():
         
     | 
| 
       72 
     | 
    
         
            -
                            temp_list = {}
         
     | 
| 
       73 
     | 
    
         
            -
                            val = merged_list[key]
         
     | 
| 
       74 
     | 
    
         
            -
                            if key in [
         
     | 
| 
       75 
     | 
    
         
            -
                                "P153_UPRN",
         
     | 
| 
       76 
     | 
    
         
            -
                                "P153_TEMP",
         
     | 
| 
       77 
     | 
    
         
            -
                                "P153_SYSDATE",
         
     | 
| 
       78 
     | 
    
         
            -
                                "P0_LANGUAGE",
         
     | 
| 
       79 
     | 
    
         
            -
                                "P153_POST_CODE",
         
     | 
| 
       80 
     | 
    
         
            -
                            ]:
         
     | 
| 
       81 
     | 
    
         
            -
                                temp_list = {"n": key, "v": val}
         
     | 
| 
       82 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       83 
     | 
    
         
            -
                            elif key in [
         
     | 
| 
       84 
     | 
    
         
            -
                                "p_flow_id",
         
     | 
| 
       85 
     | 
    
         
            -
                                "p_flow_step_id",
         
     | 
| 
       86 
     | 
    
         
            -
                                "p_instance",
         
     | 
| 
       87 
     | 
    
         
            -
                                "p_page_submission_id",
         
     | 
| 
       88 
     | 
    
         
            -
                                "p_request",
         
     | 
| 
       89 
     | 
    
         
            -
                                "p_reload_on_submit",
         
     | 
| 
       90 
     | 
    
         
            -
                            ]:
         
     | 
| 
       91 
     | 
    
         
            -
                                other_list[key] = val
         
     | 
| 
       92 
     | 
    
         
            -
                            else:
         
     | 
| 
       93 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "", "ck": val}
         
     | 
| 
       94 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                        json_builder = {
         
     | 
| 
       97 
     | 
    
         
            -
                            "pageItems": {
         
     | 
| 
       98 
     | 
    
         
            -
                                "itemsToSubmit": new_list,
         
     | 
| 
       99 
     | 
    
         
            -
                                "protected": payload_protected,
         
     | 
| 
       100 
     | 
    
         
            -
                                "rowVersion": "",
         
     | 
| 
       101 
     | 
    
         
            -
                                "formRegionChecksums": [],
         
     | 
| 
       102 
     | 
    
         
            -
                            },
         
     | 
| 
       103 
     | 
    
         
            -
                            "salt": payload_salt,
         
     | 
| 
       104 
     | 
    
         
            -
                        }
         
     | 
| 
       105 
     | 
    
         
            -
                        json_object = json.dumps(json_builder, separators=(",", ":"))
         
     | 
| 
       106 
     | 
    
         
            -
                        other_list["p_json"] = json_object
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                        # Set Referrer header
         
     | 
| 
       109 
     | 
    
         
            -
                        s.headers.update(
         
     | 
| 
       110 
     | 
    
         
            -
                            {
         
     | 
| 
       111 
     | 
    
         
            -
                                "referer": "https://iweb.itouchvision.com/portal/f?p=customer:BIN_DAYS:::NO:RP:UID:13353F039C4B1454827EE05536414091A8C058F4"
         
     | 
| 
       112 
     | 
    
         
            -
                            }
         
     | 
| 
       113 
     | 
    
         
            -
                        )
         
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
                        # Generate POST including all the JSON we just built
         
     | 
| 
       116 
     | 
    
         
            -
                        s.post(
         
     | 
| 
       117 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/wwv_flow.accept", data=other_list
         
     | 
| 
       118 
     | 
    
         
            -
                        )
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                        # The second page on the portal would normally allow you to select your property from a dropdown list of
         
     | 
| 
       121 
     | 
    
         
            -
                        # those that are at the postcode entered on the previous page
         
     | 
| 
       122 
     | 
    
         
            -
                        # The required cookies are stored within the session so re-use the session to keep them
         
     | 
| 
       123 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       124 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/itouchvision/r/customer/bin_days"
         
     | 
| 
       125 
     | 
    
         
            -
                        )
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       128 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
                        # The page contains a number of values that must be passed into subsequent requests - extract them here
         
     | 
| 
       131 
     | 
    
         
            -
                        payload = {
         
     | 
| 
       132 
     | 
    
         
            -
                            i["name"]: i.get("value", "") for i in soup.select("input[name]")
         
     | 
| 
       133 
     | 
    
         
            -
                        }
         
     | 
| 
       134 
     | 
    
         
            -
                        payload2 = {
         
     | 
| 
       135 
     | 
    
         
            -
                            i["data-for"]: i.get("value", "")
         
     | 
| 
       136 
     | 
    
         
            -
                            for i in soup.select("input[data-for]")
         
     | 
| 
       137 
     | 
    
         
            -
                        }
         
     | 
| 
       138 
     | 
    
         
            -
                        
         
     | 
| 
       139 
     | 
    
         
            -
                        # Check if required form elements exist
         
     | 
| 
       140 
     | 
    
         
            -
                        salt_element = soup.select_one('input[id="pSalt"]')
         
     | 
| 
       141 
     | 
    
         
            -
                        protected_element = soup.select_one('input[id="pPageItemsProtected"]')
         
     | 
| 
       142 
     | 
    
         
            -
                        
         
     | 
| 
       143 
     | 
    
         
            -
                        if not salt_element or not protected_element:
         
     | 
| 
       144 
     | 
    
         
            -
                            raise Exception("Required form elements not found. The council website may have changed or be unavailable.")
         
     | 
| 
       145 
     | 
    
         
            -
                        
         
     | 
| 
       146 
     | 
    
         
            -
                        payload_salt = salt_element.get("value")
         
     | 
| 
       147 
     | 
    
         
            -
                        payload_protected = protected_element.get("value")
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                        # Add the UPRN and 'SUBMIT' to the payload
         
     | 
| 
       150 
     | 
    
         
            -
                        payload["p_request"] = "SUBMIT"
         
     | 
| 
       151 
     | 
    
         
            -
                        payload["P153_UPRN"] = user_uprn
         
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                        # Manipulate the lists and build the JSON that must be submitted in further requests - some data is nested
         
     | 
| 
       154 
     | 
    
         
            -
                        merged_list = {**payload, **payload2}
         
     | 
| 
       155 
     | 
    
         
            -
                        new_list = []
         
     | 
| 
       156 
     | 
    
         
            -
                        other_list = {}
         
     | 
| 
       157 
     | 
    
         
            -
                        for key in merged_list.keys():
         
     | 
| 
       158 
     | 
    
         
            -
                            temp_list = {}
         
     | 
| 
       159 
     | 
    
         
            -
                            val = merged_list[key]
         
     | 
| 
       160 
     | 
    
         
            -
                            if key in ["P153_UPRN", "P153_TEMP", "P153_SYSDATE", "P0_LANGUAGE"]:
         
     | 
| 
       161 
     | 
    
         
            -
                                temp_list = {"n": key, "v": val}
         
     | 
| 
       162 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       163 
     | 
    
         
            -
                            elif key in ["P153_ZABY"]:
         
     | 
| 
       164 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "1", "ck": val}
         
     | 
| 
       165 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       166 
     | 
    
         
            -
                            elif key in ["P153_POST_CODE"]:
         
     | 
| 
       167 
     | 
    
         
            -
                                temp_list = {"n": key, "v": user_postcode, "ck": val}
         
     | 
| 
       168 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       169 
     | 
    
         
            -
                            elif key in [
         
     | 
| 
       170 
     | 
    
         
            -
                                "p_flow_id",
         
     | 
| 
       171 
     | 
    
         
            -
                                "p_flow_step_id",
         
     | 
| 
       172 
     | 
    
         
            -
                                "p_instance",
         
     | 
| 
       173 
     | 
    
         
            -
                                "p_page_submission_id",
         
     | 
| 
       174 
     | 
    
         
            -
                                "p_request",
         
     | 
| 
       175 
     | 
    
         
            -
                                "p_reload_on_submit",
         
     | 
| 
       176 
     | 
    
         
            -
                            ]:
         
     | 
| 
       177 
     | 
    
         
            -
                                other_list[key] = val
         
     | 
| 
       178 
     | 
    
         
            -
                            else:
         
     | 
| 
       179 
     | 
    
         
            -
                                temp_list = {"n": key, "v": "", "ck": val}
         
     | 
| 
       180 
     | 
    
         
            -
                                new_list.append(temp_list)
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                        json_builder = {
         
     | 
| 
       183 
     | 
    
         
            -
                            "pageItems": {
         
     | 
| 
       184 
     | 
    
         
            -
                                "itemsToSubmit": new_list,
         
     | 
| 
       185 
     | 
    
         
            -
                                "protected": payload_protected,
         
     | 
| 
       186 
     | 
    
         
            -
                                "rowVersion": "",
         
     | 
| 
       187 
     | 
    
         
            -
                                "formRegionChecksums": [],
         
     | 
| 
       188 
     | 
    
         
            -
                            },
         
     | 
| 
       189 
     | 
    
         
            -
                            "salt": payload_salt,
         
     | 
| 
       190 
     | 
    
         
            -
                        }
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
                        json_object = json.dumps(json_builder, separators=(",", ":"))
         
     | 
| 
       193 
     | 
    
         
            -
                        other_list["p_json"] = json_object
         
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
                        # Generate POST including all the JSON we just built
         
     | 
| 
       196 
     | 
    
         
            -
                        s.post(
         
     | 
| 
       197 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/wwv_flow.accept", data=other_list
         
     | 
| 
       198 
     | 
    
         
            -
                        )
         
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
                        # The third and final page on the portal shows the detail of the waste collection services
         
     | 
| 
       201 
     | 
    
         
            -
                        # The required cookies are stored within the session so re-use the session to keep them
         
     | 
| 
       202 
     | 
    
         
            -
                        resource = s.get(
         
     | 
| 
       203 
     | 
    
         
            -
                            "https://iweb.itouchvision.com/portal/itouchvision/r/customer/bin_days"
         
     | 
| 
       204 
     | 
    
         
            -
                        )
         
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
                        # Create a BeautifulSoup object from the page's HTML
         
     | 
| 
       207 
     | 
    
         
            -
                        soup = BeautifulSoup(resource.text, "html.parser")
         
     | 
| 
       208 
     | 
    
         
            -
            =======
         
     | 
| 
       209 
21 
     | 
    
         
             
                    driver = None
         
     | 
| 
       210 
22 
     | 
    
         
             
                    try:
         
     | 
| 
       211 
     | 
    
         
            -
            >>>>>>> master
         
     | 
| 
       212 
23 
     | 
    
         
             
                        data = {"bins": []}
         
     | 
| 
       213 
24 
     | 
    
         
             
                        url = kwargs.get("url")
         
     | 
| 
       214 
25 
     | 
    
         
             
                        user_paon = kwargs.get("paon")
         
     | 
| 
         @@ -266,9 +77,11 @@ class CouncilClass(AbstractGetBinDataClass): 
     | 
|
| 
       266 
77 
     | 
    
         
             
                        for collection in collections:
         
     | 
| 
       267 
78 
     | 
    
         
             
                            bin_type = collection.find("h3").get_text()
         
     | 
| 
       268 
79 
     | 
    
         | 
| 
       269 
     | 
    
         
            -
                            next_collection =  
     | 
| 
      
 80 
     | 
    
         
            +
                            next_collection = collection.find(
         
     | 
| 
      
 81 
     | 
    
         
            +
                                "div", {"class": "fw-bold"}
         
     | 
| 
      
 82 
     | 
    
         
            +
                            ).get_text()
         
     | 
| 
       270 
83 
     | 
    
         | 
| 
       271 
     | 
    
         
            -
                            following_collection =  
     | 
| 
      
 84 
     | 
    
         
            +
                            following_collection = collection.find(
         
     | 
| 
       272 
85 
     | 
    
         
             
                                lambda t: (
         
     | 
| 
       273 
86 
     | 
    
         
             
                                    t.name == "div"
         
     | 
| 
       274 
87 
     | 
    
         
             
                                    and t.get_text(strip=True).lower().startswith("followed by")
         
     | 
| 
         @@ -209,7 +209,7 @@ uk_bin_collection/uk_bin_collection/councils/NewarkAndSherwoodDC.py,sha256=lAleY 
     | 
|
| 
       209 
209 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/NewcastleCityCouncil.py,sha256=eJMX10CG9QO7FRhHSmUDL-jO_44qoK3_1ztNTAXhkbw,2085
         
     | 
| 
       210 
210 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/NewcastleUnderLymeCouncil.py,sha256=feuQnAG80xVojQlUBLh8wjVPVU6yLZ6sQKKjfHBKIl8,2514
         
     | 
| 
       211 
211 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/NewhamCouncil.py,sha256=zlkKm28E6zIRknAbyLeSd5LNeRctqlZ-2MIrAsdaqHg,2260
         
     | 
| 
       212 
     | 
    
         
            -
            uk_bin_collection/uk_bin_collection/councils/NewportCityCouncil.py,sha256= 
     | 
| 
      
 212 
     | 
    
         
            +
            uk_bin_collection/uk_bin_collection/councils/NewportCityCouncil.py,sha256=5Cg8MdxHLM9STKsSfCbRdHhbK9oToRsm1SlwyJcUCi8,5164
         
     | 
| 
       213 
213 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/NorthAyrshireCouncil.py,sha256=o8zv40Wt19d51mrN5lsgLMCKMokMPmI1cMHBNT5yAho,1976
         
     | 
| 
       214 
214 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/NorthDevonCountyCouncil.py,sha256=tgJKIvu7nnCAHu_HImfG5SQABD6ygKFqrZU-ZoC6ObY,6260
         
     | 
| 
       215 
215 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/NorthEastDerbyshireDistrictCouncil.py,sha256=BfNpYcjG3z0Yz8OYN6NkfzvZ5k1FI-80D-rv211kPPU,5449
         
     | 
| 
         @@ -261,7 +261,7 @@ uk_bin_collection/uk_bin_collection/councils/SheffieldCityCouncil.py,sha256=9g9A 
     | 
|
| 
       261 
261 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/ShropshireCouncil.py,sha256=6OIEhJmv-zLJiEo8WaJePA7JuhNRGkh2WohFLhzN8Kk,1477
         
     | 
| 
       262 
262 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/SloughBoroughCouncil.py,sha256=ADa-8bcTnD39Lof6FdRp_WAHQSYmHgXN3uz0uqKnW64,6367
         
     | 
| 
       263 
263 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/SolihullCouncil.py,sha256=gbTHjbdV46evGfLfF8rxVMQIgNZD-XPHgZeuyje7kGY,1609
         
     | 
| 
       264 
     | 
    
         
            -
            uk_bin_collection/uk_bin_collection/councils/SomersetCouncil.py,sha256= 
     | 
| 
      
 264 
     | 
    
         
            +
            uk_bin_collection/uk_bin_collection/councils/SomersetCouncil.py,sha256=ae-rTJL43l54glGkjjH8xciJWmyeBb_u6ZV9Smz7Egw,5060
         
     | 
| 
       265 
265 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/SouthAyrshireCouncil.py,sha256=03eapeXwxneKI4ccKPSHoviIbhmV1m90I-0WQ_s3KsY,2722
         
     | 
| 
       266 
266 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/SouthCambridgeshireCouncil.py,sha256=xGSMcikxjS4UzqKs0X50LJKmn09C-XAAs98SPhNZgkQ,2308
         
     | 
| 
       267 
267 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/SouthDerbyshireDistrictCouncil.py,sha256=irqelQSENPsZLlNtYtpt-Z7GwKUyvhp94kKKVIIDjQg,2087
         
     | 
| 
         @@ -299,7 +299,7 @@ uk_bin_collection/uk_bin_collection/councils/TandridgeDistrictCouncil.py,sha256= 
     | 
|
| 
       299 
299 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/TeignbridgeCouncil.py,sha256=-NowMNcxsnktzUxTk-XUfzFJgXKSSerCmdZ7cN4cE1s,2703
         
     | 
| 
       300 
300 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/TelfordAndWrekinCouncil.py,sha256=p1ZS5R4EGxbEWlRBrkGXgKwE_lkyBT-R60yKFFhVObc,1844
         
     | 
| 
       301 
301 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/TendringDistrictCouncil.py,sha256=1_CkpWPTfRUEP5YJ9R4_dJRLtb-O9i83hfWJc1shw_c,4283
         
     | 
| 
       302 
     | 
    
         
            -
            uk_bin_collection/uk_bin_collection/councils/TestValleyBoroughCouncil.py,sha256= 
     | 
| 
      
 302 
     | 
    
         
            +
            uk_bin_collection/uk_bin_collection/councils/TestValleyBoroughCouncil.py,sha256=c6aTRvA9kmgNadJUvUb3R1bA6EkQ7fQ3twUienAv_jY,5194
         
     | 
| 
       303 
303 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/TewkesburyBoroughCouncil.py,sha256=cSULCQBddk4tfaJZHv7mrNwM4sZkOYJpmlQXlvrZvPk,1396
         
     | 
| 
       304 
304 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/ThanetDistrictCouncil.py,sha256=Cxrf0tUryDL-wFclPH5yovVt8i7Sc7g-ZFrU9_wg6KY,2717
         
     | 
| 
       305 
305 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/ThreeRiversDistrictCouncil.py,sha256=RHt3e9oeKzwxjjY-M8aC0nk-ZXhHIoyC81JzxkPVxsE,5531
         
     | 
| 
         @@ -350,8 +350,8 @@ uk_bin_collection/uk_bin_collection/councils/tests/test_south_kesteven_district_ 
     | 
|
| 
       350 
350 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/councils/tests/test_south_kesteven_integration.py,sha256=ax_kevIIB1BpDTVjEnoiZnDk0srkc1Vw7B2i5XLLqiE,6647
         
     | 
| 
       351 
351 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
         
     | 
| 
       352 
352 
     | 
    
         
             
            uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=Qb76X46V0UMZJwO8zMNPvnVY7jNa-bmTlrirDi1tuJA,4553
         
     | 
| 
       353 
     | 
    
         
            -
            uk_bin_collection-0. 
     | 
| 
       354 
     | 
    
         
            -
            uk_bin_collection-0. 
     | 
| 
       355 
     | 
    
         
            -
            uk_bin_collection-0. 
     | 
| 
       356 
     | 
    
         
            -
            uk_bin_collection-0. 
     | 
| 
       357 
     | 
    
         
            -
            uk_bin_collection-0. 
     | 
| 
      
 353 
     | 
    
         
            +
            uk_bin_collection-0.160.1.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
         
     | 
| 
      
 354 
     | 
    
         
            +
            uk_bin_collection-0.160.1.dist-info/METADATA,sha256=BrA1hO7vKk1aIW8SBBbSX8GxyMXK5hE30pXo42V5Ny8,26815
         
     | 
| 
      
 355 
     | 
    
         
            +
            uk_bin_collection-0.160.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
         
     | 
| 
      
 356 
     | 
    
         
            +
            uk_bin_collection-0.160.1.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
         
     | 
| 
      
 357 
     | 
    
         
            +
            uk_bin_collection-0.160.1.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
    
        {uk_bin_collection-0.159.3.dist-info → uk_bin_collection-0.160.1.dist-info}/entry_points.txt
    RENAMED
    
    | 
         
            File without changes
         
     |