Repository: rotki/rotki

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

```


Discussion:
yeah seems like it. Would be really nice to know for which token that was so that I can test though

Resolving patch:
diff --git a/rotkehlchen/icons.py b/rotkehlchen/icons.py
--- a/rotkehlchen/icons.py
+++ b/rotkehlchen/icons.py
@@ -62,7 +62,12 @@ def _query_coingecko_for_icon(self, asset: Asset) -> bool:
 
         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)
 


Test patch: