@@ -284,10 +284,14 @@ async def get_posts(
284
284
)
285
285
286
286
if not post_filter :
287
- post_filter = PostFilter ()
288
- params = post_filter .as_http_params ()
289
- params ["page" ] = str (page )
290
- params ["pagination" ] = str (page_size )
287
+ params = {
288
+ "page" : str (page ),
289
+ "pagination" : str (page_size ),
290
+ }
291
+ else :
292
+ params = post_filter .as_http_params ()
293
+ params ["page" ] = str (page )
294
+ params ["pagination" ] = str (page_size )
291
295
292
296
async with self .http_session .get ("/api/v0/posts.json" , params = params ) as resp :
293
297
resp .raise_for_status ()
@@ -408,10 +412,15 @@ async def get_messages(
408
412
)
409
413
410
414
if not message_filter :
411
- message_filter = MessageFilter ()
412
- params = message_filter .as_http_params ()
413
- params ["page" ] = str (page )
414
- params ["pagination" ] = str (page_size )
415
+ params = {
416
+ "page" : str (page ),
417
+ "pagination" : str (page_size ),
418
+ }
419
+ else :
420
+ params = message_filter .as_http_params ()
421
+ params ["page" ] = str (page )
422
+ params ["pagination" ] = str (page_size )
423
+
415
424
async with self .http_session .get (
416
425
"/api/v0/messages.json" , params = params
417
426
) as resp :
@@ -479,8 +488,7 @@ async def watch_messages(
479
488
self ,
480
489
message_filter : Optional [MessageFilter ] = None ,
481
490
) -> AsyncIterable [AlephMessage ]:
482
- if not message_filter :
483
- message_filter = MessageFilter ()
491
+ message_filter = message_filter or MessageFilter ()
484
492
params = message_filter .as_http_params ()
485
493
486
494
async with self .http_session .ws_connect (
0 commit comments