We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Period task for uncached asset icons dies
## Problem Definition

From the logs I cannot see more information regarding that but I get this error:

```
Task for periodically_query_icons_until_all_cached died with exception: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?. Check the logs for more details
```

My guess is that the icon field in the response returns `"missing_thumb.png"` instead of a url. 

```
[23/08/2020 18:11:21 CEST] rotkehlchen.icons: Periodic task to query coingecko for 5 uncached asset icons. Uncached assets: 23. Cached assets: 1128
[23/08/2020 18:11:35 CEST] rotkehlchen.icons: Periodic task to query coingecko for 5 uncached asset icons. Uncached assets: 18. Cached assets: 1133
[23/08/2020 18:11:36 CEST] rotkehlchen.greenlets: Task for periodically_query_icons_until_all_cached died with exception: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?.
Exception Name: <class 'requests.exceptions.MissingSchema'>
Exception Info: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?
Traceback:
   File "src/gevent/greenlet.py", line 818, in gevent._greenlet.Greenlet.run
  File "/home/kelsos/development/github/rotki/rotkehlchen/icons.py", line 138, in periodically_query_icons_until_all_cached
    carry_on = self.query_uncached_icons_batch(batch_size=batch_size)
  File "/home/kelsos/development/github/rotki/rotkehlchen/icons.py", line 123, in query_uncached_icons_batch
    self._query_coingecko_for_icon(Asset(asset_name))
  File "/home/kelsos/development/github/rotki/rotkehlchen/icons.py", line 65, in _query_coingecko_for_icon
    response = requests.get(url)
  File "/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/sessions.py", line 510, in request
    prep = self.prepare_request(req)
  File "/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/sessions.py", line 453, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/models.py", line 313, in prepare
    self.prepare_url(url, params)
  File "/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/models.py", line 387, in prepare_url
    raise MissingSchema(error)

[23/08/2020 18:11:36 CEST] rotkehlchen.user_messages: Task for periodically_query_icons_until_all_cached died with exception: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?. Check the logs for more details

```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `rotkehlchen/icons.py`
Content:
```
1 import itertools
2 import logging
3 from pathlib import Path
4 from typing import Optional
5 
6 import gevent
7 import requests
8 from typing_extensions import Literal
9 
10 from rotkehlchen.assets.asset import Asset
11 from rotkehlchen.assets.resolver import AssetResolver, asset_type_mapping
12 from rotkehlchen.errors import RemoteError
13 from rotkehlchen.externalapis.coingecko import Coingecko
14 from rotkehlchen.typing import AssetType
15 from rotkehlchen.utils.hashing import file_md5
16 
17 log = logging.getLogger(__name__)
18 
19 
20 class IconManager():
21     """
22     Manages the icons for all the assets of the application
23 
24     The get_icon() and the periodic task of query_uncached_icons_batch() may at
25     a point query the same icon but that's fine and not worth of locking mechanism as
26     it should be rather rare and worst case scenario once in a blue moon we waste
27     an API call. In the end the right file would be written on disk.
28 """
29 
30     def __init__(self, data_dir: Path, coingecko: Coingecko) -> None:
31         self.icons_dir = data_dir / 'icons'
32         self.coingecko = coingecko
33         self.icons_dir.mkdir(parents=True, exist_ok=True)
34 
35     def iconfile_path(self, asset: Asset, size: Literal['thumb', 'small', 'large']) -> Path:
36         return self.icons_dir / f'{asset.identifier}_{size}.png'
37 
38     def iconfile_md5(
39             self,
40             asset: Asset,
41             size: Literal['thumb', 'small', 'large'],
42     ) -> Optional[str]:
43         path = self.iconfile_path(asset, size)
44         if not path.is_file():
45             return None
46 
47         return file_md5(path)
48 
49     def _query_coingecko_for_icon(self, asset: Asset) -> bool:
50         """Queries coingecko for icons of an asset
51 
52         If query was okay it returns True, else False
53         """
54         try:
55             data = self.coingecko.asset_data(asset)
56         except RemoteError as e:
57             log.warning(
58                 f'Problem querying coingecko for asset data of {asset.identifier}: {str(e)}',
59             )
60 
61             return False
62 
63         for size in ('thumb', 'small', 'large'):
64             url = getattr(data.images, size)
65             response = requests.get(url)
66             with open(self.iconfile_path(asset, size), 'wb') as f:  # type: ignore
67                 f.write(response.content)
68 
69         return True
70 
71     def get_icon(
72             self,
73             asset: Asset, given_size: Literal['thumb', 'small', 'large'],
74     ) -> Optional[bytes]:
75         """Returns the byte data of the requested icon
76 
77         If the icon can't be found it returns None.
78 
79         If the icon is found cached locally it's returned directly.
80 
81         If not,all icons of the asset are queried from coingecko and cached
82         locally before the requested data are returned.
83         """
84         if not asset.has_coingecko():
85             return None
86 
87         needed_path = self.iconfile_path(asset, given_size)
88         if needed_path.is_file():
89             with open(needed_path, 'rb') as f:
90                 image_data = f.read()
91             return image_data
92 
93         # else query coingecko for the icons and cache all of them
94         if self._query_coingecko_for_icon(asset) is False:
95             return None
96 
97         with open(needed_path, 'rb') as f:
98             image_data = f.read()
99         return image_data
100 
101     def query_uncached_icons_batch(self, batch_size: int) -> bool:
102         """Queries a batch of uncached icons for assets
103 
104         Returns true if there is more icons left to cache after this batch.
105         """
106         coingecko_integrated_assets = []
107 
108         for identifier, asset_data in AssetResolver().assets.items():
109             asset_type = asset_type_mapping[asset_data['type']]
110             if asset_type != AssetType.FIAT and asset_data['coingecko'] != '':
111                 coingecko_integrated_assets.append(identifier)
112 
113         cached_assets = [
114             str(x.name)[:-10] for x in self.icons_dir.glob('*_thumb.png') if x.is_file()
115         ]
116 
117         uncached_assets = set(coingecko_integrated_assets) - set(cached_assets)
118         log.info(
119             f'Periodic task to query coingecko for {batch_size} uncached asset icons. '
120             f'Uncached assets: {len(uncached_assets)}. Cached assets: {len(cached_assets)}',
121         )
122         for asset_name in itertools.islice(uncached_assets, batch_size):
123             self._query_coingecko_for_icon(Asset(asset_name))
124 
125         return len(uncached_assets) > batch_size
126 
127     def periodically_query_icons_until_all_cached(
128             self,
129             batch_size: int,
130             sleep_time_secs: float,
131     ) -> None:
132         """Periodically query all uncached icons until we have icons cached for all
133         of the known assets that have coingecko integration"""
134         if batch_size == 0:
135             return
136 
137         while True:
138             carry_on = self.query_uncached_icons_batch(batch_size=batch_size)
139             if not carry_on:
140                 break
141             gevent.sleep(sleep_time_secs)
142
```
--- 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/rotkehlchen/icons.py b/rotkehlchen/icons.py
--- a/rotkehlchen/icons.py
+++ b/rotkehlchen/icons.py
@@ -62,7 +62,12 @@
 
         for size in ('thumb', 'small', 'large'):
             url = getattr(data.images, size)
-            response = requests.get(url)
+            try:
+                response = requests.get(url)
+            except requests.exceptions.RequestException:
+                # Any problem getting the image skip it: https://github.com/rotki/rotki/issues/1370
+                continue
+
             with open(self.iconfile_path(asset, size), 'wb') as f:  # type: ignore
                 f.write(response.content)

{"golden_diff": "diff --git a/rotkehlchen/icons.py b/rotkehlchen/icons.py\n--- a/rotkehlchen/icons.py\n+++ b/rotkehlchen/icons.py\n@@ -62,7 +62,12 @@\n \n         for size in ('thumb', 'small', 'large'):\n             url = getattr(data.images, size)\n-            response = requests.get(url)\n+            try:\n+                response = requests.get(url)\n+            except requests.exceptions.RequestException:\n+                # Any problem getting the image skip it: https://github.com/rotki/rotki/issues/1370\n+                continue\n+\n             with open(self.iconfile_path(asset, size), 'wb') as f:  # type: ignore\n                 f.write(response.content)\n", "issue": "Period task for uncached asset icons dies\n## Problem Definition\r\n\r\nFrom the logs I cannot see more information regarding that but I get this error:\r\n\r\n```\r\nTask for periodically_query_icons_until_all_cached died with exception: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?. Check the logs for more details\r\n```\r\n\r\nMy guess is that the icon field in the response returns `\"missing_thumb.png\"` instead of a url. \r\n\r\n```\r\n[23/08/2020 18:11:21 CEST] rotkehlchen.icons: Periodic task to query coingecko for 5 uncached asset icons. Uncached assets: 23. Cached assets: 1128\r\n[23/08/2020 18:11:35 CEST] rotkehlchen.icons: Periodic task to query coingecko for 5 uncached asset icons. Uncached assets: 18. Cached assets: 1133\r\n[23/08/2020 18:11:36 CEST] rotkehlchen.greenlets: Task for periodically_query_icons_until_all_cached died with exception: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?.\r\nException Name: <class 'requests.exceptions.MissingSchema'>\r\nException Info: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?\r\nTraceback:\r\n   File \"src/gevent/greenlet.py\", line 818, in gevent._greenlet.Greenlet.run\r\n  File \"/home/kelsos/development/github/rotki/rotkehlchen/icons.py\", line 138, in periodically_query_icons_until_all_cached\r\n    carry_on = self.query_uncached_icons_batch(batch_size=batch_size)\r\n  File \"/home/kelsos/development/github/rotki/rotkehlchen/icons.py\", line 123, in query_uncached_icons_batch\r\n    self._query_coingecko_for_icon(Asset(asset_name))\r\n  File \"/home/kelsos/development/github/rotki/rotkehlchen/icons.py\", line 65, in _query_coingecko_for_icon\r\n    response = requests.get(url)\r\n  File \"/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/api.py\", line 75, in get\r\n    return request('get', url, params=params, **kwargs)\r\n  File \"/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/api.py\", line 60, in request\r\n    return session.request(method=method, url=url, **kwargs)\r\n  File \"/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/sessions.py\", line 510, in request\r\n    prep = self.prepare_request(req)\r\n  File \"/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/sessions.py\", line 453, in prepare_request\r\n    hooks=merge_hooks(request.hooks, self.hooks),\r\n  File \"/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/models.py\", line 313, in prepare\r\n    self.prepare_url(url, params)\r\n  File \"/home/kelsos/.virtualenvs/rotkehlchen/lib/python3.7/site-packages/requests/models.py\", line 387, in prepare_url\r\n    raise MissingSchema(error)\r\n\r\n[23/08/2020 18:11:36 CEST] rotkehlchen.user_messages: Task for periodically_query_icons_until_all_cached died with exception: Invalid URL 'missing_thumb.png': No schema supplied. Perhaps you meant http://missing_thumb.png?. Check the logs for more details\r\n\r\n```\n", "before_files": [{"content": "import itertools\nimport logging\nfrom pathlib import Path\nfrom typing import Optional\n\nimport gevent\nimport requests\nfrom typing_extensions import Literal\n\nfrom rotkehlchen.assets.asset import Asset\nfrom rotkehlchen.assets.resolver import AssetResolver, asset_type_mapping\nfrom rotkehlchen.errors import RemoteError\nfrom rotkehlchen.externalapis.coingecko import Coingecko\nfrom rotkehlchen.typing import AssetType\nfrom rotkehlchen.utils.hashing import file_md5\n\nlog = logging.getLogger(__name__)\n\n\nclass IconManager():\n    \"\"\"\n    Manages the icons for all the assets of the application\n\n    The get_icon() and the periodic task of query_uncached_icons_batch() may at\n    a point query the same icon but that's fine and not worth of locking mechanism as\n    it should be rather rare and worst case scenario once in a blue moon we waste\n    an API call. In the end the right file would be written on disk.\n\"\"\"\n\n    def __init__(self, data_dir: Path, coingecko: Coingecko) -> None:\n        self.icons_dir = data_dir / 'icons'\n        self.coingecko = coingecko\n        self.icons_dir.mkdir(parents=True, exist_ok=True)\n\n    def iconfile_path(self, asset: Asset, size: Literal['thumb', 'small', 'large']) -> Path:\n        return self.icons_dir / f'{asset.identifier}_{size}.png'\n\n    def iconfile_md5(\n            self,\n            asset: Asset,\n            size: Literal['thumb', 'small', 'large'],\n    ) -> Optional[str]:\n        path = self.iconfile_path(asset, size)\n        if not path.is_file():\n            return None\n\n        return file_md5(path)\n\n    def _query_coingecko_for_icon(self, asset: Asset) -> bool:\n        \"\"\"Queries coingecko for icons of an asset\n\n        If query was okay it returns True, else False\n        \"\"\"\n        try:\n            data = self.coingecko.asset_data(asset)\n        except RemoteError as e:\n            log.warning(\n                f'Problem querying coingecko for asset data of {asset.identifier}: {str(e)}',\n            )\n\n            return False\n\n        for size in ('thumb', 'small', 'large'):\n            url = getattr(data.images, size)\n            response = requests.get(url)\n            with open(self.iconfile_path(asset, size), 'wb') as f:  # type: ignore\n                f.write(response.content)\n\n        return True\n\n    def get_icon(\n            self,\n            asset: Asset, given_size: Literal['thumb', 'small', 'large'],\n    ) -> Optional[bytes]:\n        \"\"\"Returns the byte data of the requested icon\n\n        If the icon can't be found it returns None.\n\n        If the icon is found cached locally it's returned directly.\n\n        If not,all icons of the asset are queried from coingecko and cached\n        locally before the requested data are returned.\n        \"\"\"\n        if not asset.has_coingecko():\n            return None\n\n        needed_path = self.iconfile_path(asset, given_size)\n        if needed_path.is_file():\n            with open(needed_path, 'rb') as f:\n                image_data = f.read()\n            return image_data\n\n        # else query coingecko for the icons and cache all of them\n        if self._query_coingecko_for_icon(asset) is False:\n            return None\n\n        with open(needed_path, 'rb') as f:\n            image_data = f.read()\n        return image_data\n\n    def query_uncached_icons_batch(self, batch_size: int) -> bool:\n        \"\"\"Queries a batch of uncached icons for assets\n\n        Returns true if there is more icons left to cache after this batch.\n        \"\"\"\n        coingecko_integrated_assets = []\n\n        for identifier, asset_data in AssetResolver().assets.items():\n            asset_type = asset_type_mapping[asset_data['type']]\n            if asset_type != AssetType.FIAT and asset_data['coingecko'] != '':\n                coingecko_integrated_assets.append(identifier)\n\n        cached_assets = [\n            str(x.name)[:-10] for x in self.icons_dir.glob('*_thumb.png') if x.is_file()\n        ]\n\n        uncached_assets = set(coingecko_integrated_assets) - set(cached_assets)\n        log.info(\n            f'Periodic task to query coingecko for {batch_size} uncached asset icons. '\n            f'Uncached assets: {len(uncached_assets)}. Cached assets: {len(cached_assets)}',\n        )\n        for asset_name in itertools.islice(uncached_assets, batch_size):\n            self._query_coingecko_for_icon(Asset(asset_name))\n\n        return len(uncached_assets) > batch_size\n\n    def periodically_query_icons_until_all_cached(\n            self,\n            batch_size: int,\n            sleep_time_secs: float,\n    ) -> None:\n        \"\"\"Periodically query all uncached icons until we have icons cached for all\n        of the known assets that have coingecko integration\"\"\"\n        if batch_size == 0:\n            return\n\n        while True:\n            carry_on = self.query_uncached_icons_batch(batch_size=batch_size)\n            if not carry_on:\n                break\n            gevent.sleep(sleep_time_secs)\n", "path": "rotkehlchen/icons.py"}], "after_files": [{"content": "import itertools\nimport logging\nfrom pathlib import Path\nfrom typing import Optional\n\nimport gevent\nimport requests\nfrom typing_extensions import Literal\n\nfrom rotkehlchen.assets.asset import Asset\nfrom rotkehlchen.assets.resolver import AssetResolver, asset_type_mapping\nfrom rotkehlchen.errors import RemoteError\nfrom rotkehlchen.externalapis.coingecko import Coingecko\nfrom rotkehlchen.typing import AssetType\nfrom rotkehlchen.utils.hashing import file_md5\n\nlog = logging.getLogger(__name__)\n\n\nclass IconManager():\n    \"\"\"\n    Manages the icons for all the assets of the application\n\n    The get_icon() and the periodic task of query_uncached_icons_batch() may at\n    a point query the same icon but that's fine and not worth of locking mechanism as\n    it should be rather rare and worst case scenario once in a blue moon we waste\n    an API call. In the end the right file would be written on disk.\n\"\"\"\n\n    def __init__(self, data_dir: Path, coingecko: Coingecko) -> None:\n        self.icons_dir = data_dir / 'icons'\n        self.coingecko = coingecko\n        self.icons_dir.mkdir(parents=True, exist_ok=True)\n\n    def iconfile_path(self, asset: Asset, size: Literal['thumb', 'small', 'large']) -> Path:\n        return self.icons_dir / f'{asset.identifier}_{size}.png'\n\n    def iconfile_md5(\n            self,\n            asset: Asset,\n            size: Literal['thumb', 'small', 'large'],\n    ) -> Optional[str]:\n        path = self.iconfile_path(asset, size)\n        if not path.is_file():\n            return None\n\n        return file_md5(path)\n\n    def _query_coingecko_for_icon(self, asset: Asset) -> bool:\n        \"\"\"Queries coingecko for icons of an asset\n\n        If query was okay it returns True, else False\n        \"\"\"\n        try:\n            data = self.coingecko.asset_data(asset)\n        except RemoteError as e:\n            log.warning(\n                f'Problem querying coingecko for asset data of {asset.identifier}: {str(e)}',\n            )\n\n            return False\n\n        for size in ('thumb', 'small', 'large'):\n            url = getattr(data.images, size)\n            try:\n                response = requests.get(url)\n            except requests.exceptions.RequestException:\n                # Any problem getting the image skip it: https://github.com/rotki/rotki/issues/1370\n                continue\n\n            with open(self.iconfile_path(asset, size), 'wb') as f:  # type: ignore\n                f.write(response.content)\n\n        return True\n\n    def get_icon(\n            self,\n            asset: Asset, given_size: Literal['thumb', 'small', 'large'],\n    ) -> Optional[bytes]:\n        \"\"\"Returns the byte data of the requested icon\n\n        If the icon can't be found it returns None.\n\n        If the icon is found cached locally it's returned directly.\n\n        If not,all icons of the asset are queried from coingecko and cached\n        locally before the requested data are returned.\n        \"\"\"\n        if not asset.has_coingecko():\n            return None\n\n        needed_path = self.iconfile_path(asset, given_size)\n        if needed_path.is_file():\n            with open(needed_path, 'rb') as f:\n                image_data = f.read()\n            return image_data\n\n        # else query coingecko for the icons and cache all of them\n        if self._query_coingecko_for_icon(asset) is False:\n            return None\n\n        with open(needed_path, 'rb') as f:\n            image_data = f.read()\n        return image_data\n\n    def query_uncached_icons_batch(self, batch_size: int) -> bool:\n        \"\"\"Queries a batch of uncached icons for assets\n\n        Returns true if there is more icons left to cache after this batch.\n        \"\"\"\n        coingecko_integrated_assets = []\n\n        for identifier, asset_data in AssetResolver().assets.items():\n            asset_type = asset_type_mapping[asset_data['type']]\n            if asset_type != AssetType.FIAT and asset_data['coingecko'] != '':\n                coingecko_integrated_assets.append(identifier)\n\n        cached_assets = [\n            str(x.name)[:-10] for x in self.icons_dir.glob('*_thumb.png') if x.is_file()\n        ]\n\n        uncached_assets = set(coingecko_integrated_assets) - set(cached_assets)\n        log.info(\n            f'Periodic task to query coingecko for {batch_size} uncached asset icons. '\n            f'Uncached assets: {len(uncached_assets)}. Cached assets: {len(cached_assets)}',\n        )\n        for asset_name in itertools.islice(uncached_assets, batch_size):\n            self._query_coingecko_for_icon(Asset(asset_name))\n\n        return len(uncached_assets) > batch_size\n\n    def periodically_query_icons_until_all_cached(\n            self,\n            batch_size: int,\n            sleep_time_secs: float,\n    ) -> None:\n        \"\"\"Periodically query all uncached icons until we have icons cached for all\n        of the known assets that have coingecko integration\"\"\"\n        if batch_size == 0:\n            return\n\n        while True:\n            carry_on = self.query_uncached_icons_batch(batch_size=batch_size)\n            if not carry_on:\n                break\n            gevent.sleep(sleep_time_secs)\n", "path": "rotkehlchen/icons.py"}]}