@@ -489,3 +489,34 @@ def og(self, target_url):
489489 auth_token = self .create_jwt_token ("*" , "*" , feed_id = "*" )
490490 params = {"url" : target_url }
491491 return self .get ("og/" , auth_token , params = params )
492+
493+ def follow_stats (self , feed_id , followers_slugs = None , following_slugs = None ):
494+ """
495+ Retrieve the number of follower and following feed stats of a given feed.
496+ For each count, feed slugs can be provided to filter counts accordingly.
497+
498+ eg.
499+ client.follow_stats(me, followers_slugs=['user'], following_slugs=['commodities'])
500+ this means to find counts of users following me and count of commodities I am following
501+ """
502+ auth_token = self .create_jwt_token ("*" , "*" , feed_id = "*" )
503+ params = {
504+ "followers" : feed_id ,
505+ "following" : feed_id ,
506+ }
507+
508+ if followers_slugs :
509+ params ["followers_slugs" ] = (
510+ "," .join (followers_slugs )
511+ if isinstance (followers_slugs , list )
512+ else followers_slugs
513+ )
514+
515+ if following_slugs :
516+ params ["following_slugs" ] = (
517+ "," .join (following_slugs )
518+ if isinstance (following_slugs , list )
519+ else following_slugs
520+ )
521+
522+ return self .get ("stats/follow/" , auth_token , params = params )
0 commit comments