@@ -126,7 +126,7 @@ def schedule_broadcast(self, bc_id, scheduled_for):
126126
127127 * Note:
128128 This method only works on List Entry resources and
129- requires access to subscriber information . Please
129+ requires send broadcast email permissions . Please
130130 refer to the AWeber API Reference Documentation at
131131 https://labs.aweber.com/docs/reference/1.0#broadcast_scheduler
132132 for more details on how to call this method.
@@ -137,16 +137,37 @@ def schedule_broadcast(self, bc_id, scheduled_for):
137137 url = '{0}/broadcasts/{1}/schedule' .format (self .url , bc_id )
138138 return self .adapter .request ('POST' , url , body , response = 'status' )
139139
140+ def get_broadcasts (self , status , ** kwargs ):
141+ """Invoke the API method to retrieve broadcasts by status.
142+
143+ * Note:
144+ This method only works on List Entry resources. Please
145+ refer to the AWeber API Reference Documentation at
146+ https://labs.aweber.com/docs/reference/1.0#get_broadcasts
147+ for more details on how to call this method.
148+
149+ """
150+ self ._method_for ('list' )
151+ params = {'status' : status }
152+ params .update (kwargs )
153+ query_string = urlencode (params )
154+ url = '{0.url}/broadcasts?{1}' .format (self , query_string )
155+
156+ data = self .adapter .request ('GET' , url )
157+ collection = aweber_api .AWeberCollection (url , data , self .adapter )
158+ collection ._data ['total_size' ] = self ._get_broadcast_count (
159+ query_string )
160+ return collection
161+
140162 def cancel_broadcast (self , bc_id ):
141163 """Invoke the API method to cancel the given scheduled broadcast.
142164
143165 * Note:
144166 This method only works on List Entry resources and
145- requires access to subscriber and send broadcast
146- information. Please refer to the AWeber API Reference
147- Documentation at
167+ requires send broadcast email permissions. Please refer
168+ to the AWeber API Reference Documentation at
148169 https://labs.aweber.com/docs/reference/1.0#cancel_broadcast
149- more details on how to call this method.
170+ for more details on how to call this method.
150171
151172 """
152173 self ._method_for ('list' )
@@ -158,6 +179,12 @@ def _get_total_size(self, uri, **kwargs):
158179 total_size_uri = '{0}&ws.show=total_size' .format (uri )
159180 return int (self .adapter .request ('GET' , total_size_uri ))
160181
182+ def _get_broadcast_count (self , query_string ):
183+ """Get actual total size number from total_size_link."""
184+ total_size_uri = '{0.url}/broadcasts/total?{1}' .format (
185+ self , query_string )
186+ return int (self .adapter .request ('GET' , total_size_uri )['total_size' ])
187+
161188 def get_parent_entry (self ):
162189 """Return the parent entry of this entry
163190
0 commit comments