update rss_proxy.py
* testing fixes description
This commit is contained in:
@@ -14,6 +14,12 @@ CACHE_TTL = int(os.getenv("CACHE_TTL", 3600))
|
||||
|
||||
rdb = redis.from_url(REDIS_URL)
|
||||
|
||||
_head_html = f"""<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0">
|
||||
<channel><title>Tapochek.net RSS</title>
|
||||
<link>http://tapochek.net/</link>
|
||||
<ttl>15</ttl>"""
|
||||
|
||||
|
||||
def normalize_text(text):
|
||||
"""Приводит текст к нормальному виду, устраняя странные символы."""
|
||||
@@ -102,13 +108,7 @@ def init_proxy(app):
|
||||
new_items.append(item_str)
|
||||
|
||||
final_items = cached_items + new_items
|
||||
response_xml = f"""<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0">
|
||||
<channel><title>Tapochek.net RSS</title>
|
||||
<link>http://tapochek.net/</link>
|
||||
<ttl>15</ttl>
|
||||
{"".join(final_items)}
|
||||
</channel></rss>"""
|
||||
response_xml = f"""{_head_html}{"".join(final_items)}</channel></rss>"""
|
||||
|
||||
return Response(response_xml, content_type="application/xml; charset=utf-8")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user