Skip to content

fix: await async gen() calls in media_seen#229

Closed
themavik wants to merge 1 commit intosubzeroid:mainfrom
themavik:fix-media-seen-await-gen
Closed

fix: await async gen() calls in media_seen#229
themavik wants to merge 1 commit intosubzeroid:mainfrom
themavik:fix-media-seen-await-gen

Conversation

@themavik
Copy link

Summary

media_seen() calls the inner gen() coroutine function without await, passing raw coroutine objects into the request data dict. When the dict is JSON-serialized, this raises:

TypeError: Object of type coroutine is not JSON serializable

Changes

Add await to both gen() calls so the coroutines are resolved to dicts before serialization:

# Before
"reels": gen(media_ids),
"reel_media_skipped": gen(skipped_media_ids),

# After
"reels": await gen(media_ids),
"reel_media_skipped": await gen(skipped_media_ids),

Test Plan

  • await client.media_seen(["media_id"]): request is sent with properly serialized reels data instead of crashing
  • await client.story_seen([media_id]): no longer raises TypeError

Fixes #116

gen() is an async function but was called without await, causing
the coroutine objects to be passed directly into the request data
dict. JSON serialization then fails with:
TypeError: Object of type coroutine is not JSON serializable

Add await to both gen() calls so the coroutines are resolved to
dicts before being serialized.

Fixes #116

Co-authored-by: Cursor <cursoragent@cursor.com>
@themavik themavik closed this by deleting the head repository Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] "Object of type coroutine is not JSON serializable" in media_seen(), easy fix

1 participant