prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Moldova parser fails due to expired SSL certificate
  Certificate expired on Friday, 20 November 2020 at 11:15:53
  
  --- 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/MD.py`
  Content:
  ```
  1 #!/usr/bin/env python3
  2 # coding=utf-8
  3 
  4 """Parser for Moldova."""
  5 
  6 import arrow
  7 from operator import itemgetter
  8 import requests
  9 
  10 TYPE_MAPPING = {
  11     u'tmva476': 'hydro',  # NHE Costeşti (run-of-river) #2 index
  12     u'tmva112': 'hydro',  # NHE Dubăsari (run-of-river) #4 index
  13     u'tmva367': 'gas',  # CET Nord (CHPP) #3 index
  14     u'tmva42': 'gas',  # CET-1 Chişinău (CHPP) #6 index
  15     u'tmva378': 'gas',  # CET-2 Chişinău (CHPP) #5 index
  16     u'tmva1024': 'gas',  # CERS Moldovenească (fuel mix 2017 99.92% gas, 0.08% oil) #7 index
  17 }
  18 
  19 display_url = 'http://www.moldelectrica.md/ro/activity/system_state'
  20 data_url = 'http://www.moldelectrica.md/utils/load4.php'
  21 
  22 
  23 def get_data(session=None):
  24     """ Returns generation data as a list of floats."""
  25 
  26     s = session or requests.Session()
  27 
  28     #In order for the data url to return data, cookies from the display url must be obtained then reused.
  29     response = s.get(display_url)
  30     data_response = s.get(data_url)
  31     raw_data = data_response.text
  32     try:
  33         data = [float(i) for i in raw_data.split(',')]
  34     except:
  35         raise Exception("Not able to parse received data. Check that the specifed URL returns correct data.")
  36 
  37     return data
  38 
  39 
  40 def fetch_production(zone_key='MD', session=None, target_datetime=None, logger=None):
  41     """Requests the last known production mix (in MW) of a given country
  42 
  43     Arguments:
  44     zone_key (optional) -- used in case a parser is able to fetch multiple countries
  45     session (optional)      -- request session passed in order to re-use an existing session
  46 
  47     Return:
  48     A dictionary in the form:
  49     {
  50       'zoneKey': 'FR',
  51       'datetime': '2017-01-01T00:00:00Z',
  52       'production': {
  53           'biomass': 0.0,
  54           'coal': 0.0,
  55           'gas': 0.0,
  56           'hydro': 0.0,
  57           'nuclear': null,
  58           'oil': 0.0,
  59           'solar': 0.0,
  60           'wind': 0.0,
  61           'geothermal': 0.0,
  62           'unknown': 0.0
  63       },
  64       'storage': {
  65           'hydro': -10.0,
  66       },
  67       'source': 'mysource.com'
  68     }
  69     """
  70     if target_datetime:
  71         raise NotImplementedError('This parser is not yet able to parse past dates')
  72 
  73     grid_status = get_data(session=session)
  74     production = {'solar': None, 'wind': None, 'biomass': None, 'nuclear': 0.0}
  75 
  76     production['gas'] = sum(itemgetter(3, 5, 6)(grid_status))
  77     production['hydro'] = sum(itemgetter(2, 4)(grid_status))
  78     production['unknown'] = grid_status[7]
  79 
  80     consumption = grid_status[-5]
  81 
  82     dt = arrow.now('Europe/Chisinau').datetime
  83 
  84     datapoint = {
  85         'zoneKey': zone_key,
  86         'datetime': dt,
  87         'consumption': consumption,
  88         'production': production,
  89         'storage': {},
  90         'source': 'moldelectrica.md'
  91     }
  92 
  93     return datapoint
  94 
  95 
  96 def fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None):
  97     """Requests the last known power exchange (in MW) between two countries
  98     Arguments:
  99     zone_key1           -- the first country code
  100     zone_key2           -- the second country code; order of the two codes in params doesn't matter
  101     session (optional)      -- request session passed in order to re-use an existing session
  102     Return:
  103     A dictionary in the form:
  104     {
  105       'sortedZoneKeys': 'DK->NO',
  106       'datetime': '2017-01-01T00:00:00Z',
  107       'netFlow': 0.0,
  108       'source': 'mysource.com'
  109     }
  110     where net flow is from DK into NO
  111     """
  112     if target_datetime:
  113         raise NotImplementedError('This parser is not yet able to parse past dates')
  114 
  115     sortedZoneKeys = '->'.join(sorted([zone_key1, zone_key2]))
  116 
  117     exchange_status = get_data(session=session)
  118 
  119     if sortedZoneKeys == 'MD->UA':
  120         netflow = -1 * exchange_status[-3]
  121     elif sortedZoneKeys == 'MD->RO':
  122         netflow = -1 * exchange_status[-2]
  123     else:
  124         raise NotImplementedError('This exchange pair is not implemented')
  125 
  126     dt = arrow.now('Europe/Chisinau').datetime
  127 
  128     exchange = {
  129         'sortedZoneKeys': sortedZoneKeys,
  130         'datetime': dt,
  131         'netFlow': netflow,
  132         'source': 'moldelectrica.md'
  133     }
  134 
  135     return exchange
  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     print('fetch_exchange(MD, UA) ->')
  144     print(fetch_exchange('MD', 'UA'))
  145     print('fetch_exchange(MD, RO) ->')
  146     print(fetch_exchange('MD', 'RO'))
  147
  ```
  --- 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/parsers/MD.py b/parsers/MD.py
  --- a/parsers/MD.py
  +++ b/parsers/MD.py
  @@ -26,8 +26,8 @@
       s = session or requests.Session()
   
       #In order for the data url to return data, cookies from the display url must be obtained then reused.
  -    response = s.get(display_url)
  -    data_response = s.get(data_url)
  +    response = s.get(display_url, verify=False)
  +    data_response = s.get(data_url, verify=False)
       raw_data = data_response.text
       try:
           data = [float(i) for i in raw_data.split(',')]
  
verification_info: {"golden_diff": "diff --git a/parsers/MD.py b/parsers/MD.py\n--- a/parsers/MD.py\n+++ b/parsers/MD.py\n@@ -26,8 +26,8 @@\n     s = session or requests.Session()\n \n     #In order for the data url to return data, cookies from the display url must be obtained then reused.\n-    response = s.get(display_url)\n-    data_response = s.get(data_url)\n+    response = s.get(display_url, verify=False)\n+    data_response = s.get(data_url, verify=False)\n     raw_data = data_response.text\n     try:\n         data = [float(i) for i in raw_data.split(',')]\n", "issue": "Moldova parser fails due to expired SSL certificate\nCertificate expired on Friday, 20 November 2020 at 11:15:53\n", "before_files": [{"content": "#!/usr/bin/env python3\n# coding=utf-8\n\n\"\"\"Parser for Moldova.\"\"\"\n\nimport arrow\nfrom operator import itemgetter\nimport requests\n\nTYPE_MAPPING = {\n    u'tmva476': 'hydro',  # NHE Coste\u015fti (run-of-river) #2 index\n    u'tmva112': 'hydro',  # NHE Dub\u0103sari (run-of-river) #4 index\n    u'tmva367': 'gas',  # CET Nord (CHPP) #3 index\n    u'tmva42': 'gas',  # CET-1 Chi\u015fin\u0103u (CHPP) #6 index\n    u'tmva378': 'gas',  # CET-2 Chi\u015fin\u0103u (CHPP) #5 index\n    u'tmva1024': 'gas',  # CERS Moldoveneasc\u0103 (fuel mix 2017 99.92% gas, 0.08% oil) #7 index\n}\n\ndisplay_url = 'http://www.moldelectrica.md/ro/activity/system_state'\ndata_url = 'http://www.moldelectrica.md/utils/load4.php'\n\n\ndef get_data(session=None):\n    \"\"\" Returns generation data as a list of floats.\"\"\"\n\n    s = session or requests.Session()\n\n    #In order for the data url to return data, cookies from the display url must be obtained then reused.\n    response = s.get(display_url)\n    data_response = s.get(data_url)\n    raw_data = data_response.text\n    try:\n        data = [float(i) for i in raw_data.split(',')]\n    except:\n        raise Exception(\"Not able to parse received data. Check that the specifed URL returns correct data.\")\n\n    return data\n\n\ndef fetch_production(zone_key='MD', session=None, target_datetime=None, logger=None):\n    \"\"\"Requests the last known production mix (in MW) of a given country\n\n    Arguments:\n    zone_key (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'zoneKey': 'FR',\n      'datetime': '2017-01-01T00:00:00Z',\n      'production': {\n          'biomass': 0.0,\n          'coal': 0.0,\n          'gas': 0.0,\n          'hydro': 0.0,\n          'nuclear': null,\n          'oil': 0.0,\n          'solar': 0.0,\n          'wind': 0.0,\n          'geothermal': 0.0,\n          'unknown': 0.0\n      },\n      'storage': {\n          'hydro': -10.0,\n      },\n      'source': 'mysource.com'\n    }\n    \"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    grid_status = get_data(session=session)\n    production = {'solar': None, 'wind': None, 'biomass': None, 'nuclear': 0.0}\n\n    production['gas'] = sum(itemgetter(3, 5, 6)(grid_status))\n    production['hydro'] = sum(itemgetter(2, 4)(grid_status))\n    production['unknown'] = grid_status[7]\n\n    consumption = grid_status[-5]\n\n    dt = arrow.now('Europe/Chisinau').datetime\n\n    datapoint = {\n        'zoneKey': zone_key,\n        'datetime': dt,\n        'consumption': consumption,\n        'production': production,\n        'storage': {},\n        'source': 'moldelectrica.md'\n    }\n\n    return datapoint\n\n\ndef fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None):\n    \"\"\"Requests the last known power exchange (in MW) between two countries\n    Arguments:\n    zone_key1           -- the first country code\n    zone_key2           -- the second country code; order of the two codes in params doesn't matter\n    session (optional)      -- request session passed in order to re-use an existing session\n    Return:\n    A dictionary in the form:\n    {\n      'sortedZoneKeys': 'DK->NO',\n      'datetime': '2017-01-01T00:00:00Z',\n      'netFlow': 0.0,\n      'source': 'mysource.com'\n    }\n    where net flow is from DK into NO\n    \"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    sortedZoneKeys = '->'.join(sorted([zone_key1, zone_key2]))\n\n    exchange_status = get_data(session=session)\n\n    if sortedZoneKeys == 'MD->UA':\n        netflow = -1 * exchange_status[-3]\n    elif sortedZoneKeys == 'MD->RO':\n        netflow = -1 * exchange_status[-2]\n    else:\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    dt = arrow.now('Europe/Chisinau').datetime\n\n    exchange = {\n        'sortedZoneKeys': sortedZoneKeys,\n        'datetime': dt,\n        'netFlow': netflow,\n        'source': 'moldelectrica.md'\n    }\n\n    return exchange\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    print('fetch_exchange(MD, UA) ->')\n    print(fetch_exchange('MD', 'UA'))\n    print('fetch_exchange(MD, RO) ->')\n    print(fetch_exchange('MD', 'RO'))\n", "path": "parsers/MD.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n# coding=utf-8\n\n\"\"\"Parser for Moldova.\"\"\"\n\nimport arrow\nfrom operator import itemgetter\nimport requests\n\nTYPE_MAPPING = {\n    u'tmva476': 'hydro',  # NHE Coste\u015fti (run-of-river) #2 index\n    u'tmva112': 'hydro',  # NHE Dub\u0103sari (run-of-river) #4 index\n    u'tmva367': 'gas',  # CET Nord (CHPP) #3 index\n    u'tmva42': 'gas',  # CET-1 Chi\u015fin\u0103u (CHPP) #6 index\n    u'tmva378': 'gas',  # CET-2 Chi\u015fin\u0103u (CHPP) #5 index\n    u'tmva1024': 'gas',  # CERS Moldoveneasc\u0103 (fuel mix 2017 99.92% gas, 0.08% oil) #7 index\n}\n\ndisplay_url = 'http://www.moldelectrica.md/ro/activity/system_state'\ndata_url = 'http://www.moldelectrica.md/utils/load4.php'\n\n\ndef get_data(session=None):\n    \"\"\" Returns generation data as a list of floats.\"\"\"\n\n    s = session or requests.Session()\n\n    #In order for the data url to return data, cookies from the display url must be obtained then reused.\n    response = s.get(display_url, verify=False)\n    data_response = s.get(data_url, verify=False)\n    raw_data = data_response.text\n    try:\n        data = [float(i) for i in raw_data.split(',')]\n    except:\n        raise Exception(\"Not able to parse received data. Check that the specifed URL returns correct data.\")\n\n    return data\n\n\ndef fetch_production(zone_key='MD', session=None, target_datetime=None, logger=None):\n    \"\"\"Requests the last known production mix (in MW) of a given country\n\n    Arguments:\n    zone_key (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'zoneKey': 'FR',\n      'datetime': '2017-01-01T00:00:00Z',\n      'production': {\n          'biomass': 0.0,\n          'coal': 0.0,\n          'gas': 0.0,\n          'hydro': 0.0,\n          'nuclear': null,\n          'oil': 0.0,\n          'solar': 0.0,\n          'wind': 0.0,\n          'geothermal': 0.0,\n          'unknown': 0.0\n      },\n      'storage': {\n          'hydro': -10.0,\n      },\n      'source': 'mysource.com'\n    }\n    \"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    grid_status = get_data(session=session)\n    production = {'solar': None, 'wind': None, 'biomass': None, 'nuclear': 0.0}\n\n    production['gas'] = sum(itemgetter(3, 5, 6)(grid_status))\n    production['hydro'] = sum(itemgetter(2, 4)(grid_status))\n    production['unknown'] = grid_status[7]\n\n    consumption = grid_status[-5]\n\n    dt = arrow.now('Europe/Chisinau').datetime\n\n    datapoint = {\n        'zoneKey': zone_key,\n        'datetime': dt,\n        'consumption': consumption,\n        'production': production,\n        'storage': {},\n        'source': 'moldelectrica.md'\n    }\n\n    return datapoint\n\n\ndef fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None):\n    \"\"\"Requests the last known power exchange (in MW) between two countries\n    Arguments:\n    zone_key1           -- the first country code\n    zone_key2           -- the second country code; order of the two codes in params doesn't matter\n    session (optional)      -- request session passed in order to re-use an existing session\n    Return:\n    A dictionary in the form:\n    {\n      'sortedZoneKeys': 'DK->NO',\n      'datetime': '2017-01-01T00:00:00Z',\n      'netFlow': 0.0,\n      'source': 'mysource.com'\n    }\n    where net flow is from DK into NO\n    \"\"\"\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    sortedZoneKeys = '->'.join(sorted([zone_key1, zone_key2]))\n\n    exchange_status = get_data(session=session)\n\n    if sortedZoneKeys == 'MD->UA':\n        netflow = -1 * exchange_status[-3]\n    elif sortedZoneKeys == 'MD->RO':\n        netflow = -1 * exchange_status[-2]\n    else:\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    dt = arrow.now('Europe/Chisinau').datetime\n\n    exchange = {\n        'sortedZoneKeys': sortedZoneKeys,\n        'datetime': dt,\n        'netFlow': netflow,\n        'source': 'moldelectrica.md'\n    }\n\n    return exchange\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    print('fetch_exchange(MD, UA) ->')\n    print(fetch_exchange('MD', 'UA'))\n    print('fetch_exchange(MD, RO) ->')\n    print(fetch_exchange('MD', 'RO'))\n", "path": "parsers/MD.py"}]}