prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Taiwan real-time data has stopped working
  Taiwain seems to have been offline recently
  It used to work correctly, something may have changed in the data source?
  
  Kibana error description [here](https://kibana.electricitymap.org/app/kibana#/discover/10af54f0-0c4a-11e9-85c1-1d63df8c862c?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-24h,mode:quick,to:now))&_a=(columns:!(message,extra.key,level),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'96f67170-0c49-11e9-85c1-1d63df8c862c',key:level,negate:!f,params:(query:ERROR,type:phrase),type:phrase,value:ERROR),query:(match:(level:(query:ERROR,type:phrase)))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'96f67170-0c49-11e9-85c1-1d63df8c862c',key:'@timestamp',negate:!f,params:(query:'2019-02-13T09:56:26.971Z',type:phrase),type:phrase,value:'February%2013th%202019,%2010:56:26.971'),query:(match:('@timestamp':(query:'2019-02-13T09:56:26.971Z',type:phrase))))),index:'96f67170-0c49-11e9-85c1-1d63df8c862c',interval:auto,query:(language:lucene,query:''),sort:!('@timestamp',asc)))
  
  
  --- 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/TW.py`
  Content:
  ```
  1 #!/usr/bin/env python3
  2 import arrow
  3 import requests
  4 import pandas
  5 import dateutil
  6 
  7 
  8 def fetch_production(zone_key='TW', session=None, target_datetime=None, logger=None):
  9     if target_datetime:
  10         raise NotImplementedError('This parser is not yet able to parse past dates')
  11 
  12     url = 'http://data.taipower.com.tw/opendata01/apply/file/d006001/001.txt'
  13     response = requests.get(url)
  14     data = response.json()
  15 
  16     dumpDate = data['']
  17     prodData = data['aaData']
  18 
  19     tz = 'Asia/Taipei'
  20     dumpDate = arrow.get(dumpDate, 'YYYY-MM-DD HH:mm').replace(tzinfo=dateutil.tz.gettz(tz))
  21 
  22     objData = pandas.DataFrame(prodData)
  23 
  24     objData.columns = ['fueltype', 'name', 'capacity', 'output', 'percentage',
  25                        'additional']
  26 
  27     objData['fueltype'] = objData.fueltype.str.split('(').str[1]
  28     objData['fueltype'] = objData.fueltype.str.split(')').str[0]
  29     objData.drop('additional', axis=1, inplace=True)
  30     objData.drop('percentage', axis=1, inplace=True)
  31 
  32     objData = objData.convert_objects(convert_numeric=True)
  33     production = pandas.DataFrame(objData.groupby('fueltype').sum())
  34     production.columns = ['capacity', 'output']
  35 
  36     coal_capacity = production.ix['Coal'].capacity + production.ix['IPP-Coal'].capacity
  37     gas_capacity = production.ix['LNG'].capacity + production.ix['IPP-LNG'].capacity
  38     oil_capacity = production.ix['Oil'].capacity + production.ix['Diesel'].capacity
  39 
  40     coal_production = production.ix['Coal'].output + production.ix['IPP-Coal'].output
  41     gas_production = production.ix['LNG'].output + production.ix['IPP-LNG'].output
  42     oil_production = production.ix['Oil'].output + production.ix['Diesel'].output
  43 
  44     # For storage, note that load will be negative, and generation positive.
  45     # We require the opposite
  46 
  47     returndata = {
  48         'zoneKey': zone_key,
  49         'datetime': dumpDate.datetime,
  50         'production': {
  51             'coal': coal_production,
  52             'gas': gas_production,
  53             'oil': oil_production,
  54             'hydro': production.ix['Hydro'].output,
  55             'nuclear': production.ix['Nuclear'].output,
  56             'solar': production.ix['Solar'].output,
  57             'wind': production.ix['Wind'].output,
  58             'unknown': production.ix['Co-Gen'].output
  59         },
  60         'capacity': {
  61             'coal': coal_capacity,
  62             'gas': gas_capacity,
  63             'oil': oil_capacity,
  64             'hydro': production.ix['Hydro'].capacity,
  65             'hydro storage':production.ix['Pumping Gen'].capacity,
  66             'nuclear': production.ix['Nuclear'].capacity,
  67             'solar': production.ix['Solar'].capacity,
  68             'wind': production.ix['Wind'].capacity,
  69             'unknown': production.ix['Co-Gen'].capacity
  70         },
  71         'storage': {
  72             'hydro': -1 * production.ix['Pumping Load'].output - production.ix['Pumping Gen'].output
  73         },
  74         'source': 'taipower.com.tw'
  75     }
  76 
  77     return returndata
  78 
  79 
  80 if __name__ == '__main__':
  81     print(fetch_production())
  82
  ```
  --- 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/TW.py b/parsers/TW.py
  --- a/parsers/TW.py
  +++ b/parsers/TW.py
  @@ -9,7 +9,7 @@
       if target_datetime:
           raise NotImplementedError('This parser is not yet able to parse past dates')
   
  -    url = 'http://data.taipower.com.tw/opendata01/apply/file/d006001/001.txt'
  +    url = 'http://www.taipower.com.tw/d006/loadGraph/loadGraph/data/genary.txt'
       response = requests.get(url)
       data = response.json()
  
verification_info: {"golden_diff": "diff --git a/parsers/TW.py b/parsers/TW.py\n--- a/parsers/TW.py\n+++ b/parsers/TW.py\n@@ -9,7 +9,7 @@\n     if target_datetime:\n         raise NotImplementedError('This parser is not yet able to parse past dates')\n \n-    url = 'http://data.taipower.com.tw/opendata01/apply/file/d006001/001.txt'\n+    url = 'http://www.taipower.com.tw/d006/loadGraph/loadGraph/data/genary.txt'\n     response = requests.get(url)\n     data = response.json()\n", "issue": "Taiwan real-time data has stopped working\nTaiwain seems to have been offline recently\r\nIt used to work correctly, something may have changed in the data source?\r\n\r\nKibana error description [here](https://kibana.electricitymap.org/app/kibana#/discover/10af54f0-0c4a-11e9-85c1-1d63df8c862c?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-24h,mode:quick,to:now))&_a=(columns:!(message,extra.key,level),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'96f67170-0c49-11e9-85c1-1d63df8c862c',key:level,negate:!f,params:(query:ERROR,type:phrase),type:phrase,value:ERROR),query:(match:(level:(query:ERROR,type:phrase)))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'96f67170-0c49-11e9-85c1-1d63df8c862c',key:'@timestamp',negate:!f,params:(query:'2019-02-13T09:56:26.971Z',type:phrase),type:phrase,value:'February%2013th%202019,%2010:56:26.971'),query:(match:('@timestamp':(query:'2019-02-13T09:56:26.971Z',type:phrase))))),index:'96f67170-0c49-11e9-85c1-1d63df8c862c',interval:auto,query:(language:lucene,query:''),sort:!('@timestamp',asc)))\r\n\n", "before_files": [{"content": "#!/usr/bin/env python3\nimport arrow\nimport requests\nimport pandas\nimport dateutil\n\n\ndef fetch_production(zone_key='TW', session=None, target_datetime=None, logger=None):\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    url = 'http://data.taipower.com.tw/opendata01/apply/file/d006001/001.txt'\n    response = requests.get(url)\n    data = response.json()\n\n    dumpDate = data['']\n    prodData = data['aaData']\n\n    tz = 'Asia/Taipei'\n    dumpDate = arrow.get(dumpDate, 'YYYY-MM-DD HH:mm').replace(tzinfo=dateutil.tz.gettz(tz))\n\n    objData = pandas.DataFrame(prodData)\n\n    objData.columns = ['fueltype', 'name', 'capacity', 'output', 'percentage',\n                       'additional']\n\n    objData['fueltype'] = objData.fueltype.str.split('(').str[1]\n    objData['fueltype'] = objData.fueltype.str.split(')').str[0]\n    objData.drop('additional', axis=1, inplace=True)\n    objData.drop('percentage', axis=1, inplace=True)\n\n    objData = objData.convert_objects(convert_numeric=True)\n    production = pandas.DataFrame(objData.groupby('fueltype').sum())\n    production.columns = ['capacity', 'output']\n\n    coal_capacity = production.ix['Coal'].capacity + production.ix['IPP-Coal'].capacity\n    gas_capacity = production.ix['LNG'].capacity + production.ix['IPP-LNG'].capacity\n    oil_capacity = production.ix['Oil'].capacity + production.ix['Diesel'].capacity\n\n    coal_production = production.ix['Coal'].output + production.ix['IPP-Coal'].output\n    gas_production = production.ix['LNG'].output + production.ix['IPP-LNG'].output\n    oil_production = production.ix['Oil'].output + production.ix['Diesel'].output\n\n    # For storage, note that load will be negative, and generation positive.\n    # We require the opposite\n\n    returndata = {\n        'zoneKey': zone_key,\n        'datetime': dumpDate.datetime,\n        'production': {\n            'coal': coal_production,\n            'gas': gas_production,\n            'oil': oil_production,\n            'hydro': production.ix['Hydro'].output,\n            'nuclear': production.ix['Nuclear'].output,\n            'solar': production.ix['Solar'].output,\n            'wind': production.ix['Wind'].output,\n            'unknown': production.ix['Co-Gen'].output\n        },\n        'capacity': {\n            'coal': coal_capacity,\n            'gas': gas_capacity,\n            'oil': oil_capacity,\n            'hydro': production.ix['Hydro'].capacity,\n            'hydro storage':production.ix['Pumping Gen'].capacity,\n            'nuclear': production.ix['Nuclear'].capacity,\n            'solar': production.ix['Solar'].capacity,\n            'wind': production.ix['Wind'].capacity,\n            'unknown': production.ix['Co-Gen'].capacity\n        },\n        'storage': {\n            'hydro': -1 * production.ix['Pumping Load'].output - production.ix['Pumping Gen'].output\n        },\n        'source': 'taipower.com.tw'\n    }\n\n    return returndata\n\n\nif __name__ == '__main__':\n    print(fetch_production())\n", "path": "parsers/TW.py"}], "after_files": [{"content": "#!/usr/bin/env python3\nimport arrow\nimport requests\nimport pandas\nimport dateutil\n\n\ndef fetch_production(zone_key='TW', session=None, target_datetime=None, logger=None):\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    url = 'http://www.taipower.com.tw/d006/loadGraph/loadGraph/data/genary.txt'\n    response = requests.get(url)\n    data = response.json()\n\n    dumpDate = data['']\n    prodData = data['aaData']\n\n    tz = 'Asia/Taipei'\n    dumpDate = arrow.get(dumpDate, 'YYYY-MM-DD HH:mm').replace(tzinfo=dateutil.tz.gettz(tz))\n\n    objData = pandas.DataFrame(prodData)\n\n    objData.columns = ['fueltype', 'name', 'capacity', 'output', 'percentage',\n                       'additional']\n\n    objData['fueltype'] = objData.fueltype.str.split('(').str[1]\n    objData['fueltype'] = objData.fueltype.str.split(')').str[0]\n    objData.drop('additional', axis=1, inplace=True)\n    objData.drop('percentage', axis=1, inplace=True)\n\n    objData = objData.convert_objects(convert_numeric=True)\n    production = pandas.DataFrame(objData.groupby('fueltype').sum())\n    production.columns = ['capacity', 'output']\n\n    coal_capacity = production.ix['Coal'].capacity + production.ix['IPP-Coal'].capacity\n    gas_capacity = production.ix['LNG'].capacity + production.ix['IPP-LNG'].capacity\n    oil_capacity = production.ix['Oil'].capacity + production.ix['Diesel'].capacity\n\n    coal_production = production.ix['Coal'].output + production.ix['IPP-Coal'].output\n    gas_production = production.ix['LNG'].output + production.ix['IPP-LNG'].output\n    oil_production = production.ix['Oil'].output + production.ix['Diesel'].output\n\n    # For storage, note that load will be negative, and generation positive.\n    # We require the opposite\n\n    returndata = {\n        'zoneKey': zone_key,\n        'datetime': dumpDate.datetime,\n        'production': {\n            'coal': coal_production,\n            'gas': gas_production,\n            'oil': oil_production,\n            'hydro': production.ix['Hydro'].output,\n            'nuclear': production.ix['Nuclear'].output,\n            'solar': production.ix['Solar'].output,\n            'wind': production.ix['Wind'].output,\n            'unknown': production.ix['Co-Gen'].output\n        },\n        'capacity': {\n            'coal': coal_capacity,\n            'gas': gas_capacity,\n            'oil': oil_capacity,\n            'hydro': production.ix['Hydro'].capacity,\n            'hydro storage':production.ix['Pumping Gen'].capacity,\n            'nuclear': production.ix['Nuclear'].capacity,\n            'solar': production.ix['Solar'].capacity,\n            'wind': production.ix['Wind'].capacity,\n            'unknown': production.ix['Co-Gen'].capacity\n        },\n        'storage': {\n            'hydro': -1 * production.ix['Pumping Load'].output - production.ix['Pumping Gen'].output\n        },\n        'source': 'taipower.com.tw'\n    }\n\n    return returndata\n\n\nif __name__ == '__main__':\n    print(fetch_production())\n", "path": "parsers/TW.py"}]}