prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  recycleapp_be not working for some addresses
  when I enter my address into the configuration.yaml I receive this error on restart:
  ```
  fetch failed for source Recycle!: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py", 
  line 116, in fetch entries = self._source.fetch() File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py", 
  line 79, in fetch entries.append(Collection(date, item["fraction"]["name"]["en"])) KeyError: 'name'
  ```
  when I use the example address or some other addresses everything works fine. Is it a problem with my city? Because other addresses of this city also don't work, even though those addresses work on [Recycle!](https://recycleapp.be/home).
  this is what I have in configuration.yaml
  ```
  waste_collection_schedule:
    sources:
      - name: recycleapp_be
        args:
          postcode: 3001
          street: Waversebaan
          house_number: 276
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py`
  Content:
  ```
  1 import logging
  2 from datetime import datetime, timedelta
  3 
  4 import requests
  5 from waste_collection_schedule import Collection  # type: ignore[attr-defined]
  6 
  7 TITLE = "Recycle!"
  8 DESCRIPTION = "Source for RecycleApp.be"
  9 URL = "https://www.recycleapp.be"
  10 TEST_CASES = {
  11     "1140 Evere, Bazellaan 1": {
  12         "postcode": 1140,
  13         "street": "Bazellaan",
  14         "house_number": 1,
  15     }
  16 }
  17 
  18 _LOGGER = logging.getLogger(__name__)
  19 
  20 
  21 class Source:
  22     def __init__(self, postcode, street, house_number):
  23         self._postcode = postcode
  24         self._street = street
  25         self._house_number = house_number
  26 
  27     def fetch(self):
  28         url = "https://recycleapp.be/api/app/v1"
  29         headers = {
  30             "x-secret": "Crgja3EGWe8jdapyr4EEoMBgZACYYjRRcRpaMQrLDW9HJBvmgkfGQyYqLgeXPavAGvnJqkV87PBB2b8zx43q46sUgzqio4yRZbABhtKeagkVKypTEDjKfPgGycjLyJTtLHYpzwJgp4YmmCuJZN9ZmJY8CGEoFs8MKfdJpU9RjkEVfngmmk2LYD4QzFegLNKUbcCeAdEW",
  31             "x-consumer": "recycleapp.be",
  32             "User-Agent": "",
  33             "Authorization": "",
  34         }
  35         r = requests.get(f"{url}/access-token", headers=headers)
  36         headers["Authorization"] = r.json()["accessToken"]
  37 
  38         params = {"q": self._postcode}
  39         r = requests.get(f"{url}/zipcodes", params=params, headers=headers)
  40         if r.status_code != 200:
  41             _LOGGER.error("Get zip code failed")
  42             return []
  43         zipcodeId = r.json()["items"][0]["id"]
  44 
  45         params = {"q": self._street, "zipcodes": zipcodeId}
  46         r = requests.get(f"{url}/streets", params=params, headers=headers)
  47         if r.status_code != 200:
  48             _LOGGER.error("Get street id failed")
  49             return []
  50 
  51         for item in r.json()["items"]:
  52             if item["name"] == self._street:
  53                 streetId = item["id"]
  54         if streetId is None:
  55             streetId = r.json()["items"][0]["id"]
  56 
  57         now = datetime.now()
  58         fromDate = now.strftime("%Y-%m-%d")
  59         untilDate = (now + timedelta(days=365)).strftime("%Y-%m-%d")
  60         params = {
  61             "zipcodeId": zipcodeId,
  62             "streetId": streetId,
  63             "houseNumber": self._house_number,
  64             "fromDate": fromDate,
  65             "untilDate": untilDate,
  66             #            "size":100,
  67         }
  68         r = requests.get(f"{url}/collections", params=params, headers=headers)
  69         if r.status_code != 200:
  70             _LOGGER.error("Get data failed")
  71             return []
  72 
  73         entries = []
  74         for item in r.json()["items"]:
  75             if "exception" in item and "replacedBy" in item["exception"]:
  76                 continue
  77 
  78             date = datetime.strptime(item["timestamp"], "%Y-%m-%dT%H:%M:%S.000Z").date()
  79             entries.append(Collection(date, item["fraction"]["name"]["en"]))
  80         return entries
  81
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py
  --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py
  +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py
  @@ -12,17 +12,29 @@
           "postcode": 1140,
           "street": "Bazellaan",
           "house_number": 1,
  -    }
  +    },
  +    "3001, Waversebaan 276 with events": {
  +        "postcode": 3001,
  +        "street": "Waversebaan",
  +        "house_number": 276,
  +    },
  +    "3001, Waversebaan 276 without events": {
  +        "postcode": 3001,
  +        "street": "Waversebaan",
  +        "house_number": 276,
  +        "add_events": False,
  +    },
   }
   
   _LOGGER = logging.getLogger(__name__)
   
   
   class Source:
  -    def __init__(self, postcode, street, house_number):
  +    def __init__(self, postcode, street, house_number, add_events=True):
           self._postcode = postcode
           self._street = street
           self._house_number = house_number
  +        self._add_events = add_events
   
       def fetch(self):
           url = "https://recycleapp.be/api/app/v1"
  @@ -76,5 +88,9 @@
                   continue
   
               date = datetime.strptime(item["timestamp"], "%Y-%m-%dT%H:%M:%S.000Z").date()
  -            entries.append(Collection(date, item["fraction"]["name"]["en"]))
  +            if item["type"] == "collection":
  +                entries.append(Collection(date, item["fraction"]["name"]["en"]))
  +            elif item["type"] == "event" and self._add_events:
  +                entries.append(Collection(date, item["event"]["title"]["en"]))
  +
           return entries
  
verification_info: {"golden_diff": "diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\n--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\n+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\n@@ -12,17 +12,29 @@\n         \"postcode\": 1140,\n         \"street\": \"Bazellaan\",\n         \"house_number\": 1,\n-    }\n+    },\n+    \"3001, Waversebaan 276 with events\": {\n+        \"postcode\": 3001,\n+        \"street\": \"Waversebaan\",\n+        \"house_number\": 276,\n+    },\n+    \"3001, Waversebaan 276 without events\": {\n+        \"postcode\": 3001,\n+        \"street\": \"Waversebaan\",\n+        \"house_number\": 276,\n+        \"add_events\": False,\n+    },\n }\n \n _LOGGER = logging.getLogger(__name__)\n \n \n class Source:\n-    def __init__(self, postcode, street, house_number):\n+    def __init__(self, postcode, street, house_number, add_events=True):\n         self._postcode = postcode\n         self._street = street\n         self._house_number = house_number\n+        self._add_events = add_events\n \n     def fetch(self):\n         url = \"https://recycleapp.be/api/app/v1\"\n@@ -76,5 +88,9 @@\n                 continue\n \n             date = datetime.strptime(item[\"timestamp\"], \"%Y-%m-%dT%H:%M:%S.000Z\").date()\n-            entries.append(Collection(date, item[\"fraction\"][\"name\"][\"en\"]))\n+            if item[\"type\"] == \"collection\":\n+                entries.append(Collection(date, item[\"fraction\"][\"name\"][\"en\"]))\n+            elif item[\"type\"] == \"event\" and self._add_events:\n+                entries.append(Collection(date, item[\"event\"][\"title\"][\"en\"]))\n+\n         return entries\n", "issue": "recycleapp_be not working for some addresses\nwhen I enter my address into the configuration.yaml I receive this error on restart:\r\n```\r\nfetch failed for source Recycle!: Traceback (most recent call last): File \"/config/custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py\", \r\nline 116, in fetch entries = self._source.fetch() File \"/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py\", \r\nline 79, in fetch entries.append(Collection(date, item[\"fraction\"][\"name\"][\"en\"])) KeyError: 'name'\r\n```\r\nwhen I use the example address or some other addresses everything works fine. Is it a problem with my city? Because other addresses of this city also don't work, even though those addresses work on [Recycle!](https://recycleapp.be/home).\r\nthis is what I have in configuration.yaml\r\n```\r\nwaste_collection_schedule:\r\n  sources:\r\n    - name: recycleapp_be\r\n      args:\r\n        postcode: 3001\r\n        street: Waversebaan\r\n        house_number: 276\r\n```\n", "before_files": [{"content": "import logging\nfrom datetime import datetime, timedelta\n\nimport requests\nfrom waste_collection_schedule import Collection  # type: ignore[attr-defined]\n\nTITLE = \"Recycle!\"\nDESCRIPTION = \"Source for RecycleApp.be\"\nURL = \"https://www.recycleapp.be\"\nTEST_CASES = {\n    \"1140 Evere, Bazellaan 1\": {\n        \"postcode\": 1140,\n        \"street\": \"Bazellaan\",\n        \"house_number\": 1,\n    }\n}\n\n_LOGGER = logging.getLogger(__name__)\n\n\nclass Source:\n    def __init__(self, postcode, street, house_number):\n        self._postcode = postcode\n        self._street = street\n        self._house_number = house_number\n\n    def fetch(self):\n        url = \"https://recycleapp.be/api/app/v1\"\n        headers = {\n            \"x-secret\": \"Crgja3EGWe8jdapyr4EEoMBgZACYYjRRcRpaMQrLDW9HJBvmgkfGQyYqLgeXPavAGvnJqkV87PBB2b8zx43q46sUgzqio4yRZbABhtKeagkVKypTEDjKfPgGycjLyJTtLHYpzwJgp4YmmCuJZN9ZmJY8CGEoFs8MKfdJpU9RjkEVfngmmk2LYD4QzFegLNKUbcCeAdEW\",\n            \"x-consumer\": \"recycleapp.be\",\n            \"User-Agent\": \"\",\n            \"Authorization\": \"\",\n        }\n        r = requests.get(f\"{url}/access-token\", headers=headers)\n        headers[\"Authorization\"] = r.json()[\"accessToken\"]\n\n        params = {\"q\": self._postcode}\n        r = requests.get(f\"{url}/zipcodes\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get zip code failed\")\n            return []\n        zipcodeId = r.json()[\"items\"][0][\"id\"]\n\n        params = {\"q\": self._street, \"zipcodes\": zipcodeId}\n        r = requests.get(f\"{url}/streets\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get street id failed\")\n            return []\n\n        for item in r.json()[\"items\"]:\n            if item[\"name\"] == self._street:\n                streetId = item[\"id\"]\n        if streetId is None:\n            streetId = r.json()[\"items\"][0][\"id\"]\n\n        now = datetime.now()\n        fromDate = now.strftime(\"%Y-%m-%d\")\n        untilDate = (now + timedelta(days=365)).strftime(\"%Y-%m-%d\")\n        params = {\n            \"zipcodeId\": zipcodeId,\n            \"streetId\": streetId,\n            \"houseNumber\": self._house_number,\n            \"fromDate\": fromDate,\n            \"untilDate\": untilDate,\n            #            \"size\":100,\n        }\n        r = requests.get(f\"{url}/collections\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get data failed\")\n            return []\n\n        entries = []\n        for item in r.json()[\"items\"]:\n            if \"exception\" in item and \"replacedBy\" in item[\"exception\"]:\n                continue\n\n            date = datetime.strptime(item[\"timestamp\"], \"%Y-%m-%dT%H:%M:%S.000Z\").date()\n            entries.append(Collection(date, item[\"fraction\"][\"name\"][\"en\"]))\n        return entries\n", "path": "custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py"}], "after_files": [{"content": "import logging\nfrom datetime import datetime, timedelta\n\nimport requests\nfrom waste_collection_schedule import Collection  # type: ignore[attr-defined]\n\nTITLE = \"Recycle!\"\nDESCRIPTION = \"Source for RecycleApp.be\"\nURL = \"https://www.recycleapp.be\"\nTEST_CASES = {\n    \"1140 Evere, Bazellaan 1\": {\n        \"postcode\": 1140,\n        \"street\": \"Bazellaan\",\n        \"house_number\": 1,\n    },\n    \"3001, Waversebaan 276 with events\": {\n        \"postcode\": 3001,\n        \"street\": \"Waversebaan\",\n        \"house_number\": 276,\n    },\n    \"3001, Waversebaan 276 without events\": {\n        \"postcode\": 3001,\n        \"street\": \"Waversebaan\",\n        \"house_number\": 276,\n        \"add_events\": False,\n    },\n}\n\n_LOGGER = logging.getLogger(__name__)\n\n\nclass Source:\n    def __init__(self, postcode, street, house_number, add_events=True):\n        self._postcode = postcode\n        self._street = street\n        self._house_number = house_number\n        self._add_events = add_events\n\n    def fetch(self):\n        url = \"https://recycleapp.be/api/app/v1\"\n        headers = {\n            \"x-secret\": \"Crgja3EGWe8jdapyr4EEoMBgZACYYjRRcRpaMQrLDW9HJBvmgkfGQyYqLgeXPavAGvnJqkV87PBB2b8zx43q46sUgzqio4yRZbABhtKeagkVKypTEDjKfPgGycjLyJTtLHYpzwJgp4YmmCuJZN9ZmJY8CGEoFs8MKfdJpU9RjkEVfngmmk2LYD4QzFegLNKUbcCeAdEW\",\n            \"x-consumer\": \"recycleapp.be\",\n            \"User-Agent\": \"\",\n            \"Authorization\": \"\",\n        }\n        r = requests.get(f\"{url}/access-token\", headers=headers)\n        headers[\"Authorization\"] = r.json()[\"accessToken\"]\n\n        params = {\"q\": self._postcode}\n        r = requests.get(f\"{url}/zipcodes\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get zip code failed\")\n            return []\n        zipcodeId = r.json()[\"items\"][0][\"id\"]\n\n        params = {\"q\": self._street, \"zipcodes\": zipcodeId}\n        r = requests.get(f\"{url}/streets\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get street id failed\")\n            return []\n\n        for item in r.json()[\"items\"]:\n            if item[\"name\"] == self._street:\n                streetId = item[\"id\"]\n        if streetId is None:\n            streetId = r.json()[\"items\"][0][\"id\"]\n\n        now = datetime.now()\n        fromDate = now.strftime(\"%Y-%m-%d\")\n        untilDate = (now + timedelta(days=365)).strftime(\"%Y-%m-%d\")\n        params = {\n            \"zipcodeId\": zipcodeId,\n            \"streetId\": streetId,\n            \"houseNumber\": self._house_number,\n            \"fromDate\": fromDate,\n            \"untilDate\": untilDate,\n            #            \"size\":100,\n        }\n        r = requests.get(f\"{url}/collections\", params=params, headers=headers)\n        if r.status_code != 200:\n            _LOGGER.error(\"Get data failed\")\n            return []\n\n        entries = []\n        for item in r.json()[\"items\"]:\n            if \"exception\" in item and \"replacedBy\" in item[\"exception\"]:\n                continue\n\n            date = datetime.strptime(item[\"timestamp\"], \"%Y-%m-%dT%H:%M:%S.000Z\").date()\n            if item[\"type\"] == \"collection\":\n                entries.append(Collection(date, item[\"fraction\"][\"name\"][\"en\"]))\n            elif item[\"type\"] == \"event\" and self._add_events:\n                entries.append(Collection(date, item[\"event\"][\"title\"][\"en\"]))\n\n        return entries\n", "path": "custom_components/waste_collection_schedule/waste_collection_schedule/source/recycleapp_be.py"}]}