# publisher/platforms/reels.py import httpx from .auth import get_token from .base import validate_payload async def publish_reels(payload): payload = validate_payload(payload) token = get_token("META_ACCESS_TOKEN") ig_id = get_token("INSTAGRAM_ACCOUNT_ID") async with httpx.AsyncClient() as client: # Create media container create = await client.post( f"https://graph.facebook.com/v19.0/{ig_id}/media", data={ "video_url": payload["video_path"], "caption": payload["caption"], "access_token": token, "media_type": "REELS", }, ) container = create.json()["id"] # Publish publish = await client.post( f"https://graph.facebook.com/v19.0/{ig_id}/media_publish", data={ "creation_id": container, "access_token": token, }, ) return {"platform": "reels", "status": "published"}