prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Primrose Schools
  Is generating 1,221 errors. Adding a if statement for `content` should fix it. Could also be turned into a sitemap spider.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `locations/spiders/primrose_schools.py`
  Content:
  ```
  1 import json
  2 
  3 import scrapy
  4 
  5 from locations.items import GeojsonPointItem
  6 
  7 
  8 class PrimroseSchoolsSpider(scrapy.Spider):
  9     name = "primrose_schools"
  10     item_attributes = {"brand": "Primrose Schools", "brand_wikidata": "Q7243677"}
  11     allowed_domains = ["primroseschools.com"]
  12 
  13     start_urls = ["https://www.primroseschools.com/find-a-school/"]
  14 
  15     def parse(self, response):
  16         with open(
  17             "./locations/searchable_points/us_centroids_50mile_radius.csv"
  18         ) as points:
  19             next(points)
  20             for point in points:
  21                 row = point.replace("\n", "").split(",")
  22                 lati = row[1]
  23                 long = row[2]
  24                 searchurl = "https://www.primroseschools.com/find-a-school/?search_string=USA&latitude={la}&longitude={lo}".format(
  25                     la=lati, lo=long
  26                 )
  27                 yield scrapy.Request(
  28                     response.urljoin(searchurl), callback=self.parse_search
  29                 )
  30 
  31     def parse_search(self, response):
  32         content = response.xpath('//script[@type="application/json"]/text()').get()
  33         schools = json.loads(content)
  34         for i in schools:
  35             if i["address_1"]:
  36                 properties = {
  37                     "name": i["name"],
  38                     "addr_full": i["address_1"] + " " + i["address_2"],
  39                     "city": i["city"],
  40                     "state": i["state"],
  41                     "postcode": i["zip_code"],
  42                     "phone": i["phone"],
  43                     "ref": i["id"],
  44                     "website": "https://www.primroseschools.com" + i["url"],
  45                     "lat": float(i["latitude"]),
  46                     "lon": float(i["longitude"]),
  47                 }
  48                 yield GeojsonPointItem(**properties)
  49
  ```
  --- 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/locations/spiders/primrose_schools.py b/locations/spiders/primrose_schools.py
  --- a/locations/spiders/primrose_schools.py
  +++ b/locations/spiders/primrose_schools.py
  @@ -30,12 +30,17 @@
   
       def parse_search(self, response):
           content = response.xpath('//script[@type="application/json"]/text()').get()
  +        if content is None:
  +            return
  +
           schools = json.loads(content)
           for i in schools:
               if i["address_1"]:
                   properties = {
                       "name": i["name"],
  -                    "addr_full": i["address_1"] + " " + i["address_2"],
  +                    "street_address": ", ".join(
  +                        filter(None, [i["address_1"], i["address_2"]])
  +                    ),
                       "city": i["city"],
                       "state": i["state"],
                       "postcode": i["zip_code"],
  
verification_info: {"golden_diff": "diff --git a/locations/spiders/primrose_schools.py b/locations/spiders/primrose_schools.py\n--- a/locations/spiders/primrose_schools.py\n+++ b/locations/spiders/primrose_schools.py\n@@ -30,12 +30,17 @@\n \n     def parse_search(self, response):\n         content = response.xpath('//script[@type=\"application/json\"]/text()').get()\n+        if content is None:\n+            return\n+\n         schools = json.loads(content)\n         for i in schools:\n             if i[\"address_1\"]:\n                 properties = {\n                     \"name\": i[\"name\"],\n-                    \"addr_full\": i[\"address_1\"] + \" \" + i[\"address_2\"],\n+                    \"street_address\": \", \".join(\n+                        filter(None, [i[\"address_1\"], i[\"address_2\"]])\n+                    ),\n                     \"city\": i[\"city\"],\n                     \"state\": i[\"state\"],\n                     \"postcode\": i[\"zip_code\"],\n", "issue": "Primrose Schools\nIs generating 1,221 errors. Adding a if statement for `content` should fix it. Could also be turned into a sitemap spider.\n", "before_files": [{"content": "import json\n\nimport scrapy\n\nfrom locations.items import GeojsonPointItem\n\n\nclass PrimroseSchoolsSpider(scrapy.Spider):\n    name = \"primrose_schools\"\n    item_attributes = {\"brand\": \"Primrose Schools\", \"brand_wikidata\": \"Q7243677\"}\n    allowed_domains = [\"primroseschools.com\"]\n\n    start_urls = [\"https://www.primroseschools.com/find-a-school/\"]\n\n    def parse(self, response):\n        with open(\n            \"./locations/searchable_points/us_centroids_50mile_radius.csv\"\n        ) as points:\n            next(points)\n            for point in points:\n                row = point.replace(\"\\n\", \"\").split(\",\")\n                lati = row[1]\n                long = row[2]\n                searchurl = \"https://www.primroseschools.com/find-a-school/?search_string=USA&latitude={la}&longitude={lo}\".format(\n                    la=lati, lo=long\n                )\n                yield scrapy.Request(\n                    response.urljoin(searchurl), callback=self.parse_search\n                )\n\n    def parse_search(self, response):\n        content = response.xpath('//script[@type=\"application/json\"]/text()').get()\n        schools = json.loads(content)\n        for i in schools:\n            if i[\"address_1\"]:\n                properties = {\n                    \"name\": i[\"name\"],\n                    \"addr_full\": i[\"address_1\"] + \" \" + i[\"address_2\"],\n                    \"city\": i[\"city\"],\n                    \"state\": i[\"state\"],\n                    \"postcode\": i[\"zip_code\"],\n                    \"phone\": i[\"phone\"],\n                    \"ref\": i[\"id\"],\n                    \"website\": \"https://www.primroseschools.com\" + i[\"url\"],\n                    \"lat\": float(i[\"latitude\"]),\n                    \"lon\": float(i[\"longitude\"]),\n                }\n                yield GeojsonPointItem(**properties)\n", "path": "locations/spiders/primrose_schools.py"}], "after_files": [{"content": "import json\n\nimport scrapy\n\nfrom locations.items import GeojsonPointItem\n\n\nclass PrimroseSchoolsSpider(scrapy.Spider):\n    name = \"primrose_schools\"\n    item_attributes = {\"brand\": \"Primrose Schools\", \"brand_wikidata\": \"Q7243677\"}\n    allowed_domains = [\"primroseschools.com\"]\n\n    start_urls = [\"https://www.primroseschools.com/find-a-school/\"]\n\n    def parse(self, response):\n        with open(\n            \"./locations/searchable_points/us_centroids_50mile_radius.csv\"\n        ) as points:\n            next(points)\n            for point in points:\n                row = point.replace(\"\\n\", \"\").split(\",\")\n                lati = row[1]\n                long = row[2]\n                searchurl = \"https://www.primroseschools.com/find-a-school/?search_string=USA&latitude={la}&longitude={lo}\".format(\n                    la=lati, lo=long\n                )\n                yield scrapy.Request(\n                    response.urljoin(searchurl), callback=self.parse_search\n                )\n\n    def parse_search(self, response):\n        content = response.xpath('//script[@type=\"application/json\"]/text()').get()\n        if content is None:\n            return\n\n        schools = json.loads(content)\n        for i in schools:\n            if i[\"address_1\"]:\n                properties = {\n                    \"name\": i[\"name\"],\n                    \"street_address\": \", \".join(\n                        filter(None, [i[\"address_1\"], i[\"address_2\"]])\n                    ),\n                    \"city\": i[\"city\"],\n                    \"state\": i[\"state\"],\n                    \"postcode\": i[\"zip_code\"],\n                    \"phone\": i[\"phone\"],\n                    \"ref\": i[\"id\"],\n                    \"website\": \"https://www.primroseschools.com\" + i[\"url\"],\n                    \"lat\": float(i[\"latitude\"]),\n                    \"lon\": float(i[\"longitude\"]),\n                }\n                yield GeojsonPointItem(**properties)\n", "path": "locations/spiders/primrose_schools.py"}]}