Reworked snapshot template output
All checks were successful
Build Docker Image / build (push) Successful in 34s
All checks were successful
Build Docker Image / build (push) Successful in 34s
This commit is contained in:
@@ -175,8 +175,7 @@ class SnapshotDownloader:
|
|||||||
params["cursor"] = cursor
|
params["cursor"] = cursor
|
||||||
|
|
||||||
# Add type IDs - API expects typeIDs[]=15 format
|
# Add type IDs - API expects typeIDs[]=15 format
|
||||||
for type_id in type_ids:
|
params["typeIDs[]"] = type_ids
|
||||||
params["typeIDs[]"] = type_id
|
|
||||||
|
|
||||||
# Build URL with parameters
|
# Build URL with parameters
|
||||||
query_string = urlencode(params, doseq=True)
|
query_string = urlencode(params, doseq=True)
|
||||||
@@ -192,6 +191,13 @@ class SnapshotDownloader:
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = await response.json()
|
data = await response.json()
|
||||||
|
|
||||||
|
# Log API response summary
|
||||||
|
posts_count = len(data.get("posts", []))
|
||||||
|
has_cursor = bool(data.get("cursor"))
|
||||||
|
self.logger.info(
|
||||||
|
f"API Response: status={response.status}, posts={posts_count}, has_next_page={has_cursor}"
|
||||||
|
)
|
||||||
|
|
||||||
# Print detailed response information for debugging if enabled
|
# Print detailed response information for debugging if enabled
|
||||||
if self.debug_mode:
|
if self.debug_mode:
|
||||||
page_info = f"cursor: {cursor[:20]}..." if cursor else "first page"
|
page_info = f"cursor: {cursor[:20]}..." if cursor else "first page"
|
||||||
@@ -202,11 +208,9 @@ class SnapshotDownloader:
|
|||||||
print(
|
print(
|
||||||
f"Response Keys: {list(data.keys()) if isinstance(data, dict) else 'Not a dict'}"
|
f"Response Keys: {list(data.keys()) if isinstance(data, dict) else 'Not a dict'}"
|
||||||
)
|
)
|
||||||
print(f"Posts count: {len(data.get('posts', []))}")
|
print(f"Posts count: {posts_count}")
|
||||||
print(f"Cursor: {data.get('cursor', 'None')}")
|
print(f"Cursor: {data.get('cursor', 'None')}")
|
||||||
if (
|
if posts_count <= 3: # Only print full data if few posts
|
||||||
len(data.get("posts", [])) <= 3
|
|
||||||
): # Only print full data if few posts
|
|
||||||
print("Full Response Data:")
|
print("Full Response Data:")
|
||||||
print(json.dumps(data, indent=2, default=str))
|
print(json.dumps(data, indent=2, default=str))
|
||||||
print("=" * 50)
|
print("=" * 50)
|
||||||
@@ -282,6 +286,22 @@ class SnapshotDownloader:
|
|||||||
self.logger.info(
|
self.logger.info(
|
||||||
f"Page {page_count}: {len(snapshots)} snapshots (total: {len(all_snapshots)})"
|
f"Page {page_count}: {len(snapshots)} snapshots (total: {len(all_snapshots)})"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Log sample of retrieved snapshots for visibility
|
||||||
|
if snapshots:
|
||||||
|
first = snapshots[0]
|
||||||
|
child_name = first.get("child", {}).get("forename", "Unknown") if first.get("child") else "Unknown"
|
||||||
|
start_time = first.get("startTime", "Unknown")[:10] if first.get("startTime") else "Unknown"
|
||||||
|
self.logger.info(
|
||||||
|
f" → First snapshot: child={child_name}, date={start_time}, id={first.get('id', 'N/A')[:8]}..."
|
||||||
|
)
|
||||||
|
if len(snapshots) > 1:
|
||||||
|
last = snapshots[-1]
|
||||||
|
child_name = last.get("child", {}).get("forename", "Unknown") if last.get("child") else "Unknown"
|
||||||
|
start_time = last.get("startTime", "Unknown")[:10] if last.get("startTime") else "Unknown"
|
||||||
|
self.logger.info(
|
||||||
|
f" → Last snapshot: child={child_name}, date={start_time}, id={last.get('id', 'N/A')[:8]}..."
|
||||||
|
)
|
||||||
|
|
||||||
# If no cursor returned, we've reached the end
|
# If no cursor returned, we've reached the end
|
||||||
if not new_cursor:
|
if not new_cursor:
|
||||||
@@ -296,6 +316,13 @@ class SnapshotDownloader:
|
|||||||
break
|
break
|
||||||
|
|
||||||
self.logger.info(f"Total snapshots fetched: {len(all_snapshots)}")
|
self.logger.info(f"Total snapshots fetched: {len(all_snapshots)}")
|
||||||
|
|
||||||
|
# Log summary of date range covered
|
||||||
|
if all_snapshots:
|
||||||
|
dates = [s.get("startTime", "")[:10] for s in all_snapshots if s.get("startTime")]
|
||||||
|
if dates:
|
||||||
|
self.logger.info(f"Date range in results: {min(dates)} to {max(dates)}")
|
||||||
|
|
||||||
return all_snapshots
|
return all_snapshots
|
||||||
|
|
||||||
async def format_snapshot_html(
|
async def format_snapshot_html(
|
||||||
|
|||||||
Reference in New Issue
Block a user