custom-components / feedparser

📰 RSS Feed Integration
MIT License
145 stars 33 forks source link

cannot use dynamic date in feed_url #60

Open yoyomax80400 opened 2 years ago

yoyomax80400 commented 2 years ago

I can't use {{now().strftime('%d-%m-%Y')}}in the feed_url, it's seem to never work ..

could please tell me if it's possible ?

yoyomax80400 commented 2 years ago

This is the track from the log

Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/local/share/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 684, in async_device_update await task File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/homeassistant/custom_components/feedparser/sensor.py", line 93, in update parsed_feed = feedparser.parse(self._feed) File "/usr/local/share/homeassistant/lib/python3.9/site-packages/feedparser/api.py", line 216, in parse data = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result) File "/usr/local/share/homeassistant/lib/python3.9/site-packages/feedparser/api.py", line 115, in _open_resource return http.get(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result) File "/usr/local/share/homeassistant/lib/python3.9/site-packages/feedparser/http.py", line 171, in get f = opener.open(request) File "/usr/local/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/usr/local/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/usr/local/lib/python3.9/urllib/request.py", line 1389, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/usr/local/lib/python3.9/urllib/request.py", line 1346, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/usr/local/lib/python3.9/http/client.py", line 1285, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.9/http/client.py", line 1296, in _send_request self.putrequest(method, url, **skips) File "/usr/local/share/homeassistant/lib/python3.9/site-packages/homeassistant/util/async_.py", line 152, in protected_loop_func return func(*args, **kwargs) File "/usr/local/lib/python3.9/http/client.py", line 1130, in putrequest self._validate_path(url) File "/usr/local/lib/python3.9/http/client.py", line 1230, in _validate_path raise InvalidURL(f"URL can't contain control characters. {url!r} " http.client.InvalidURL: URL can't contain control characters. "/templates/webnext_exclusive/views/includes/epg_cache/programme-tv-rss_{{'{:02d}-{:02d}-{}'.format(now().day, now().month, now().year)}}.xml" (found at least ' ')