File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ import os
2+
3+ from dotenv import load_dotenv
4+
5+ from substack import Api
6+
7+ load_dotenv ()
8+
9+ if __name__ == "__main__" :
10+ api = Api (
11+ email = os .getenv ("EMAIL" ),
12+ password = os .getenv ("PASSWORD" ),
13+ publication_url = os .getenv ("PUBLICATION_URL" ),
14+ )
15+
16+ subscriberCount : int = api .get_publication_subscriber_count ()
17+ print (f"Subscriber count: { subscriberCount } " )
Original file line number Diff line number Diff line change @@ -103,6 +103,18 @@ def get_publication_users(self):
103103
104104 return Api ._handle_response (response = response )
105105
106+ def get_publication_subscriber_count (self ):
107+
108+ """
109+ Get subscriber count.
110+
111+ Returns:
112+
113+ """
114+ response = self ._session .get (f"{ self .publication_url } /publication_launch_checklist" )
115+
116+ return Api ._handle_response (response = response )['subscriberCount' ]
117+
106118 def get_posts (self ) -> dict :
107119 """
108120
You can’t perform that action at this time.
0 commit comments