We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
CA-PE production parser down
## Description

This is an automatic error report generated for Canada Prince Edward Island (CA-PE).

Issues:
- No recent data found for `production` parser

## Suggestions
- Try running the parser locally using the command `poetry run test_parser CA-PE production`
- <a href="https://storage.googleapis.com/electricitymap-parser-logs/CA-PE.html">Explore the runtime logs</a>

You can see an overview of all parser issues [here](https://github.com/tmrowco/electricitymap-contrib/wiki/Parser-issues).


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `parsers/CA_PE.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 import json
4 
5 # The arrow library is used to handle datetimes consistently with other parsers
6 import arrow
7 
8 # The request library is used to fetch content through HTTP
9 import requests
10 
11 
12 timezone = 'Canada/Atlantic'
13 
14 
15 def _find_pei_key(pei_list, sought_key):
16     matching_item = [item for item in pei_list
17                      if 'header' in item['data']
18                      and item['data']['header'].startswith(sought_key)]
19 
20     if not matching_item:
21         return None
22 
23     return matching_item[0]['data']['actualValue']
24 
25 
26 def _get_pei_info(requests_obj):
27     url = 'https://wdf.princeedwardisland.ca/workflow'
28     request = {'featureName': 'WindEnergy', 'queryName': 'WindEnergy'}
29     headers = {'Content-Type': 'application/json'}
30     response = requests_obj.post(url, data=json.dumps(request), headers=headers)
31 
32     raw_data = response.json().get('data', [])
33 
34     datetime_item = [item['data']['text'] for item in raw_data
35                      if 'text' in item['data']]
36     if not datetime_item:
37         # unable to get a timestamp, return empty
38         return None
39     datetime_text = datetime_item[0][len('Last updated '):]
40     data_timestamp = arrow.get(datetime_text, 'MMMM D, YYYY HH:mm A').replace(tzinfo='Canada/Atlantic')
41 
42     # see https://ruk.ca/content/new-api-endpoint-pei-wind for more info
43     data = {
44         'pei_load': _find_pei_key(raw_data, 'Total On-Island Load'),
45         'pei_wind_gen': _find_pei_key(raw_data, 'Total On-Island Wind Generation'),
46         'pei_fossil_gen': _find_pei_key(raw_data, 'Total On-Island Fossil Fuel Generation'),
47         'pei_wind_used': _find_pei_key(raw_data, 'Wind Power Used On Island'),
48         'pei_wind_exported': _find_pei_key(raw_data, 'Wind Power Exported Off Island'),
49         'datetime': data_timestamp.datetime
50     }
51 
52     # the following keys are always required downstream, if we don't have them, no sense returning
53     if data['pei_wind_gen'] is None or data['pei_fossil_gen'] is None:
54         return None
55 
56     return data
57 
58 
59 def fetch_production(zone_key='CA-PE', session=None, target_datetime=None, logger=None) -> dict:
60     """Requests the last known production mix (in MW) of a given country."""
61     if target_datetime:
62         raise NotImplementedError('This parser is not yet able to parse past dates')
63 
64     requests_obj = session or requests.session()
65     pei_info = _get_pei_info(requests_obj)
66 
67     if pei_info is None:
68         return None
69 
70     data = {
71         'datetime': pei_info['datetime'],
72         'zoneKey': zone_key,
73         'production': {
74             'wind': pei_info['pei_wind_gen'],
75 
76             # These are oil-fueled ("heavy fuel oil" and "diesel") generators
77             # used as peakers and back-up
78             'oil': pei_info['pei_fossil_gen'],
79 
80             # specify some sources that definitely aren't present on PEI as zero,
81             # this allows the analyzer to better estimate CO2eq
82             'coal': 0,
83             'hydro': 0,
84             'nuclear': 0,
85             'geothermal': 0
86         },
87         'storage': {},
88         'source': 'princeedwardisland.ca'
89     }
90 
91     return data
92 
93 
94 def fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None) -> dict:
95     """Requests the last known power exchange (in MW) between two regions."""
96     if target_datetime:
97         raise NotImplementedError('This parser is not yet able to parse past dates')
98 
99     sorted_zone_keys = '->'.join(sorted([zone_key1, zone_key2]))
100 
101     if sorted_zone_keys != 'CA-NB->CA-PE':
102         raise NotImplementedError('This exchange pair is not implemented')
103 
104     requests_obj = session or requests.session()
105     pei_info = _get_pei_info(requests_obj)
106 
107     if pei_info is None or pei_info['pei_load'] is None:
108         return None
109 
110     # PEI imports most of its electricity. Everything not generated on island
111     # is imported from New Brunswick.
112     # In case of wind, some is paper-"exported" even if there is a net import,
113     # and 'pei_wind_used'/'data5' indicates their accounting of part of the load
114     # served by non-exported wind.
115     # https://www.princeedwardisland.ca/en/feature/pei-wind-energy says:
116     # "Wind Power Exported Off-Island is that portion of wind generation that is supplying
117     # contracts elsewhere. The actual electricity from this portion of wind generation
118     # may stay within PEI but is satisfying a contractual arrangement in another jurisdiction."
119     # We are ignoring these paper exports, as they are an accounting/legal detail
120     # that doesn't actually reflect what happens on the wires.
121     # (New Brunswick being the only interconnection with PEI, "exporting" wind power to NB
122     # then "importing" a balance of NB electricity likely doesn't actually happen.)
123     imported_from_nb = (pei_info['pei_load'] - pei_info['pei_fossil_gen'] - pei_info['pei_wind_gen'])
124 
125     # In expected result, "net" represents an export.
126     # We have sorted_zone_keys 'CA-NB->CA-PE', so it's export *from* NB,
127     # and import *to* PEI.
128     data = {
129         'datetime': pei_info['datetime'],
130         'sortedZoneKeys': sorted_zone_keys,
131         'netFlow': imported_from_nb,
132         'source': 'princeedwardisland.ca'
133     }
134 
135     return data
136 
137 
138 if __name__ == '__main__':
139     """Main method, never used by the Electricity Map backend, but handy for testing."""
140 
141     print('fetch_production() ->')
142     print(fetch_production())
143 
144     print('fetch_exchange("CA-PE", "CA-NB") ->')
145     print(fetch_exchange("CA-PE", "CA-NB"))
146
```
--- 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()

```

diff --git a/parsers/CA_PE.py b/parsers/CA_PE.py
--- a/parsers/CA_PE.py
+++ b/parsers/CA_PE.py
@@ -24,7 +24,7 @@
 
 
 def _get_pei_info(requests_obj):
-    url = 'https://wdf.princeedwardisland.ca/workflow'
+    url = 'https://wdf.princeedwardisland.ca/api/workflow'
     request = {'featureName': 'WindEnergy', 'queryName': 'WindEnergy'}
     headers = {'Content-Type': 'application/json'}
     response = requests_obj.post(url, data=json.dumps(request), headers=headers)

{"golden_diff": "diff --git a/parsers/CA_PE.py b/parsers/CA_PE.py\n--- a/parsers/CA_PE.py\n+++ b/parsers/CA_PE.py\n@@ -24,7 +24,7 @@\n \n \n def _get_pei_info(requests_obj):\n-    url = 'https://wdf.princeedwardisland.ca/workflow'\n+    url = 'https://wdf.princeedwardisland.ca/api/workflow'\n     request = {'featureName': 'WindEnergy', 'queryName': 'WindEnergy'}\n     headers = {'Content-Type': 'application/json'}\n     response = requests_obj.post(url, data=json.dumps(request), headers=headers)\n", "issue": "CA-PE production parser down\n## Description\n\nThis is an automatic error report generated for Canada Prince Edward Island (CA-PE).\n\nIssues:\n- No recent data found for `production` parser\n\n## Suggestions\n- Try running the parser locally using the command `poetry run test_parser CA-PE production`\n- <a href=\"https://storage.googleapis.com/electricitymap-parser-logs/CA-PE.html\">Explore the runtime logs</a>\n\nYou can see an overview of all parser issues [here](https://github.com/tmrowco/electricitymap-contrib/wiki/Parser-issues).\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n\nimport json\n\n# The arrow library is used to handle datetimes consistently with other parsers\nimport arrow\n\n# The request library is used to fetch content through HTTP\nimport requests\n\n\ntimezone = 'Canada/Atlantic'\n\n\ndef _find_pei_key(pei_list, sought_key):\n    matching_item = [item for item in pei_list\n                     if 'header' in item['data']\n                     and item['data']['header'].startswith(sought_key)]\n\n    if not matching_item:\n        return None\n\n    return matching_item[0]['data']['actualValue']\n\n\ndef _get_pei_info(requests_obj):\n    url = 'https://wdf.princeedwardisland.ca/workflow'\n    request = {'featureName': 'WindEnergy', 'queryName': 'WindEnergy'}\n    headers = {'Content-Type': 'application/json'}\n    response = requests_obj.post(url, data=json.dumps(request), headers=headers)\n\n    raw_data = response.json().get('data', [])\n\n    datetime_item = [item['data']['text'] for item in raw_data\n                     if 'text' in item['data']]\n    if not datetime_item:\n        # unable to get a timestamp, return empty\n        return None\n    datetime_text = datetime_item[0][len('Last updated '):]\n    data_timestamp = arrow.get(datetime_text, 'MMMM D, YYYY HH:mm A').replace(tzinfo='Canada/Atlantic')\n\n    # see https://ruk.ca/content/new-api-endpoint-pei-wind for more info\n    data = {\n        'pei_load': _find_pei_key(raw_data, 'Total On-Island Load'),\n        'pei_wind_gen': _find_pei_key(raw_data, 'Total On-Island Wind Generation'),\n        'pei_fossil_gen': _find_pei_key(raw_data, 'Total On-Island Fossil Fuel Generation'),\n        'pei_wind_used': _find_pei_key(raw_data, 'Wind Power Used On Island'),\n        'pei_wind_exported': _find_pei_key(raw_data, 'Wind Power Exported Off Island'),\n        'datetime': data_timestamp.datetime\n    }\n\n    # the following keys are always required downstream, if we don't have them, no sense returning\n    if data['pei_wind_gen'] is None or data['pei_fossil_gen'] is None:\n        return None\n\n    return data\n\n\ndef fetch_production(zone_key='CA-PE', session=None, target_datetime=None, logger=None) -> dict:\n    \"\"\"Requests the last known production mix (in MW) of a given country.\"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    requests_obj = session or requests.session()\n    pei_info = _get_pei_info(requests_obj)\n\n    if pei_info is None:\n        return None\n\n    data = {\n        'datetime': pei_info['datetime'],\n        'zoneKey': zone_key,\n        'production': {\n            'wind': pei_info['pei_wind_gen'],\n\n            # These are oil-fueled (\"heavy fuel oil\" and \"diesel\") generators\n            # used as peakers and back-up\n            'oil': pei_info['pei_fossil_gen'],\n\n            # specify some sources that definitely aren't present on PEI as zero,\n            # this allows the analyzer to better estimate CO2eq\n            'coal': 0,\n            'hydro': 0,\n            'nuclear': 0,\n            'geothermal': 0\n        },\n        'storage': {},\n        'source': 'princeedwardisland.ca'\n    }\n\n    return data\n\n\ndef fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None) -> dict:\n    \"\"\"Requests the last known power exchange (in MW) between two regions.\"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    sorted_zone_keys = '->'.join(sorted([zone_key1, zone_key2]))\n\n    if sorted_zone_keys != 'CA-NB->CA-PE':\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    requests_obj = session or requests.session()\n    pei_info = _get_pei_info(requests_obj)\n\n    if pei_info is None or pei_info['pei_load'] is None:\n        return None\n\n    # PEI imports most of its electricity. Everything not generated on island\n    # is imported from New Brunswick.\n    # In case of wind, some is paper-\"exported\" even if there is a net import,\n    # and 'pei_wind_used'/'data5' indicates their accounting of part of the load\n    # served by non-exported wind.\n    # https://www.princeedwardisland.ca/en/feature/pei-wind-energy says:\n    # \"Wind Power Exported Off-Island is that portion of wind generation that is supplying\n    # contracts elsewhere. The actual electricity from this portion of wind generation\n    # may stay within PEI but is satisfying a contractual arrangement in another jurisdiction.\"\n    # We are ignoring these paper exports, as they are an accounting/legal detail\n    # that doesn't actually reflect what happens on the wires.\n    # (New Brunswick being the only interconnection with PEI, \"exporting\" wind power to NB\n    # then \"importing\" a balance of NB electricity likely doesn't actually happen.)\n    imported_from_nb = (pei_info['pei_load'] - pei_info['pei_fossil_gen'] - pei_info['pei_wind_gen'])\n\n    # In expected result, \"net\" represents an export.\n    # We have sorted_zone_keys 'CA-NB->CA-PE', so it's export *from* NB,\n    # and import *to* PEI.\n    data = {\n        'datetime': pei_info['datetime'],\n        'sortedZoneKeys': sorted_zone_keys,\n        'netFlow': imported_from_nb,\n        'source': 'princeedwardisland.ca'\n    }\n\n    return data\n\n\nif __name__ == '__main__':\n    \"\"\"Main method, never used by the Electricity Map backend, but handy for testing.\"\"\"\n\n    print('fetch_production() ->')\n    print(fetch_production())\n\n    print('fetch_exchange(\"CA-PE\", \"CA-NB\") ->')\n    print(fetch_exchange(\"CA-PE\", \"CA-NB\"))\n", "path": "parsers/CA_PE.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\nimport json\n\n# The arrow library is used to handle datetimes consistently with other parsers\nimport arrow\n\n# The request library is used to fetch content through HTTP\nimport requests\n\n\ntimezone = 'Canada/Atlantic'\n\n\ndef _find_pei_key(pei_list, sought_key):\n    matching_item = [item for item in pei_list\n                     if 'header' in item['data']\n                     and item['data']['header'].startswith(sought_key)]\n\n    if not matching_item:\n        return None\n\n    return matching_item[0]['data']['actualValue']\n\n\ndef _get_pei_info(requests_obj):\n    url = 'https://wdf.princeedwardisland.ca/api/workflow'\n    request = {'featureName': 'WindEnergy', 'queryName': 'WindEnergy'}\n    headers = {'Content-Type': 'application/json'}\n    response = requests_obj.post(url, data=json.dumps(request), headers=headers)\n\n    raw_data = response.json().get('data', [])\n\n    datetime_item = [item['data']['text'] for item in raw_data\n                     if 'text' in item['data']]\n    if not datetime_item:\n        # unable to get a timestamp, return empty\n        return None\n    datetime_text = datetime_item[0][len('Last updated '):]\n    data_timestamp = arrow.get(datetime_text, 'MMMM D, YYYY HH:mm A').replace(tzinfo='Canada/Atlantic')\n\n    # see https://ruk.ca/content/new-api-endpoint-pei-wind for more info\n    data = {\n        'pei_load': _find_pei_key(raw_data, 'Total On-Island Load'),\n        'pei_wind_gen': _find_pei_key(raw_data, 'Total On-Island Wind Generation'),\n        'pei_fossil_gen': _find_pei_key(raw_data, 'Total On-Island Fossil Fuel Generation'),\n        'pei_wind_used': _find_pei_key(raw_data, 'Wind Power Used On Island'),\n        'pei_wind_exported': _find_pei_key(raw_data, 'Wind Power Exported Off Island'),\n        'datetime': data_timestamp.datetime\n    }\n\n    # the following keys are always required downstream, if we don't have them, no sense returning\n    if data['pei_wind_gen'] is None or data['pei_fossil_gen'] is None:\n        return None\n\n    return data\n\n\ndef fetch_production(zone_key='CA-PE', session=None, target_datetime=None, logger=None) -> dict:\n    \"\"\"Requests the last known production mix (in MW) of a given country.\"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    requests_obj = session or requests.session()\n    pei_info = _get_pei_info(requests_obj)\n\n    if pei_info is None:\n        return None\n\n    data = {\n        'datetime': pei_info['datetime'],\n        'zoneKey': zone_key,\n        'production': {\n            'wind': pei_info['pei_wind_gen'],\n\n            # These are oil-fueled (\"heavy fuel oil\" and \"diesel\") generators\n            # used as peakers and back-up\n            'oil': pei_info['pei_fossil_gen'],\n\n            # specify some sources that definitely aren't present on PEI as zero,\n            # this allows the analyzer to better estimate CO2eq\n            'coal': 0,\n            'hydro': 0,\n            'nuclear': 0,\n            'geothermal': 0\n        },\n        'storage': {},\n        'source': 'princeedwardisland.ca'\n    }\n\n    return data\n\n\ndef fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None) -> dict:\n    \"\"\"Requests the last known power exchange (in MW) between two regions.\"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    sorted_zone_keys = '->'.join(sorted([zone_key1, zone_key2]))\n\n    if sorted_zone_keys != 'CA-NB->CA-PE':\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    requests_obj = session or requests.session()\n    pei_info = _get_pei_info(requests_obj)\n\n    if pei_info is None or pei_info['pei_load'] is None:\n        return None\n\n    # PEI imports most of its electricity. Everything not generated on island\n    # is imported from New Brunswick.\n    # In case of wind, some is paper-\"exported\" even if there is a net import,\n    # and 'pei_wind_used'/'data5' indicates their accounting of part of the load\n    # served by non-exported wind.\n    # https://www.princeedwardisland.ca/en/feature/pei-wind-energy says:\n    # \"Wind Power Exported Off-Island is that portion of wind generation that is supplying\n    # contracts elsewhere. The actual electricity from this portion of wind generation\n    # may stay within PEI but is satisfying a contractual arrangement in another jurisdiction.\"\n    # We are ignoring these paper exports, as they are an accounting/legal detail\n    # that doesn't actually reflect what happens on the wires.\n    # (New Brunswick being the only interconnection with PEI, \"exporting\" wind power to NB\n    # then \"importing\" a balance of NB electricity likely doesn't actually happen.)\n    imported_from_nb = (pei_info['pei_load'] - pei_info['pei_fossil_gen'] - pei_info['pei_wind_gen'])\n\n    # In expected result, \"net\" represents an export.\n    # We have sorted_zone_keys 'CA-NB->CA-PE', so it's export *from* NB,\n    # and import *to* PEI.\n    data = {\n        'datetime': pei_info['datetime'],\n        'sortedZoneKeys': sorted_zone_keys,\n        'netFlow': imported_from_nb,\n        'source': 'princeedwardisland.ca'\n    }\n\n    return data\n\n\nif __name__ == '__main__':\n    \"\"\"Main method, never used by the Electricity Map backend, but handy for testing.\"\"\"\n\n    print('fetch_production() ->')\n    print(fetch_production())\n\n    print('fetch_exchange(\"CA-PE\", \"CA-NB\") ->')\n    print(fetch_exchange(\"CA-PE\", \"CA-NB\"))\n", "path": "parsers/CA_PE.py"}]}