e
This commit is contained in:
parent
856ddda848
commit
00000d9186
10 changed files with 36 additions and 440 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import asyncio
|
||||
import io
|
||||
import json
|
||||
import ssl
|
||||
import xml.etree.ElementTree as ET
|
||||
from datetime import datetime, timedelta
|
||||
|
|
@ -19,6 +18,7 @@ from .utils import (
|
|||
load_cache,
|
||||
now,
|
||||
safe_process_event,
|
||||
write_cache,
|
||||
)
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
|
@ -82,7 +82,11 @@ async def fetch_xml_stream(url: str, ssl_ctx: ssl.SSLContext) -> io.BytesIO | No
|
|||
buffer = io.BytesIO()
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10, verify=ssl_ctx) as client:
|
||||
async with httpx.AsyncClient(
|
||||
timeout=10,
|
||||
verify=ssl_ctx,
|
||||
follow_redirects=True,
|
||||
) as client:
|
||||
async with client.stream("GET", url) as r:
|
||||
r.raise_for_status()
|
||||
|
||||
|
|
@ -322,4 +326,4 @@ async def main(client: httpx.AsyncClient) -> None:
|
|||
else:
|
||||
log.info("No new events found")
|
||||
|
||||
CACHE_FILE.write_text(json.dumps(cached_urls, indent=2), encoding="utf-8")
|
||||
write_cache(CACHE_FILE, cached_urls)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue