AttributeError: 'list' object has no attribute 'lower'
Opened this issue · 1 comments
I tried running the dockerized version of cachet-url-monitor, but I get the following error when running from master:
monitor_1 | Traceback (most recent call last):
monitor_1 | File "./cachet_url_monitor/scheduler.py", line 158, in <module>
monitor_1 | client: CachetClient = CachetClient(api_url, token)
monitor_1 | File "/usr/local/lib/python3.7/site-packages/cachet_url_monitor-0.6.11-py3.7.egg/cachet_url_monitor/client.py", line 31, in __init__
monitor_1 | self.url = normalize_url(url)
monitor_1 | File "/usr/local/lib/python3.7/site-packages/cachet_url_monitor-0.6.11-py3.7.egg/cachet_url_monitor/client.py", line 13, in normalize_url
monitor_1 | if not url.lower().startswith("http"):
monitor_1 | AttributeError: 'list' object has no attribute 'lower'
I'm not very familiar with Python, so I don't know how to fix it myself, but it seems the problem is that url
in client.py:l13
is treated as a list instead of a string.
@erazemk I was seeing this error as well and after doing a little bit of debugging, I found out what was causing it.
Basically, the api_url
does not support the ENVIRONMENT VARIABLE
method for retrieval as the token
does. So it did not work when my configuration was as follows:
...
cachet:
api_url:
- type: ENVIRONMENT_VARIABLE
value: CACHET_URL
token:
- type: TOKEN
value: my_token
...
I had to instead hard-code the URL into the config.yml
like this:
...
cachet:
api_url: http://status.cachethq.io/api/v1
token:
- type: TOKEN
value: my_token
...
I know that the the Docker version does say to do it like the former but perhaps that changed in some version of cachet-url-monitor
.