Feed API

class aioqzone_feed.api.feed.FeedH5Api(*args, **kwds)

在 0.13.0 版本加入.

new_batch()

The new_batch() function edit internal batch id and return it.

A batch id can be used to identify a batch, thus even the same feed can have different id e.g. (bid, uin, abstime).

返回类型:

int

返回:

An identifier of the new batch.

async get_feedpage_by_uin(uin=None, attach_info=None)

This method combines get_active_feeds() and get_feeds() , depends on the uin passed in.

返回类型:

FeedPageResp

async _get_feeds_by_pred(stop_pred, uin=None, filter_pred=None)
返回:

number of feeds that we have fetched actually.

抛出:

tenacity.RetryError -- Exception from get_active_feeds().

备注

You may need new_batch() to generate a new batch id.

async get_feeds_by_count(count=10, *, uin=None)

Get feeds by count.

参数:

count (int) -- feeds count to get, max as 10, defaults to 10

返回类型:

int

async get_feeds_by_second(seconds, *, uin=None, start=None)

Get feeds by abstime (seconds). Range: [start - seconds, start].

参数:
  • seconds (float) -- filter on abstime, calculate from start.

  • start (Optional[float]) -- start timestamp, defaults to None, means now.

返回类型:

int

drop_rule(feed)

Drop feeds according to some rules. No need to emit feed_dropped event, it is handled by _dispatch_feed().

Subclasses may inherit this method to customize their own rules.

参数:

feed (Union[FeedData, ProfileFeedData]) -- the feed

返回类型:

bool

返回:

if the feed is dropped.

feed_dropped

This emitter is triggered when a feed is dropped.

feed_processed

This emitter is triggered when a feed is processed.

feed_media_updated

This emitter is triggered when a feed's media is updated.

stop_fetch

This hook is used to determin whether a fetch should stop.

ch_feed_notify

A future store serves as message notify channel.

hb_failed

This emitter is triggered when the heartbeat fails because of a exception.

hb_refresh

This emitter is triggered after a heartbeat succeeded and there are new feeds. Use this event to wait for all dispatch task to be finished, and send received feeds.

ch_heartbeat_notify

A future store serves as heartbeat channel.

async wait()

Wait until all feeds are dispatched and emitted.

在 1.2.1.dev1 版本加入.

stop()

Clear all registered tasks. All tasks will be CANCELLED if not finished.

返回类型:

None