diff --git a/api/birdxplorer_api/routers/data.py b/api/birdxplorer_api/routers/data.py index 2959dbc..18e86a5 100644 --- a/api/birdxplorer_api/routers/data.py +++ b/api/birdxplorer_api/routers/data.py @@ -3,6 +3,7 @@ from dateutil.parser import parse as dateutil_parse from fastapi import APIRouter, HTTPException, Query, Request +from pydantic import HttpUrl from birdxplorer_common.models import ( BaseModel, @@ -124,8 +125,7 @@ def get_posts( total_count = len(posts) paginated_posts = posts[offset : offset + limit] for post in paginated_posts: - post.link = f"https://x.com/{post.x_user.name}/status/{post.post_id}" - + post.link = HttpUrl(f"https://x.com/{post.x_user.name}/status/{post.post_id}") base_url = str(request.url).split("?")[0] next_offset = offset + limit