def all(self, limit=100, offset=0, stype=None, as_json=False): """Get paginated details of all Subscribers from your account. look at https://developers.mailerlite.com/v2/reference#subscribers Parameters ---------- limit : int How many subscribers you want offset : int page index stype : str Define subscriber type: Here are the possible values: * None - All subscribers (default) * active * unsubscribed * bounced * junk * unconfirmed as_json : bool return result as json format Returns ------- subscribers: list all desired Subscribers. More informations : https://developers.mailerlite.com/v2/reference#subscribers """ params = {'limit': limit, 'offset': offset} if stype and stype.lower() in [ 'active', 'unsubscribed', 'bounced', 'junk', 'unconfirmed' ]: params.update({'type': stype}) url = client.build_url('subscribers', **params) res_code, res_json = client.get(url, headers=self.headers) if as_json or not res_json: return res_json for res in res_json: res['fields'] = [Field(**field) for field in res['fields']] all_subscribers = [Subscriber(**res) for res in res_json] return all_subscribers