def get_campaigns(self, limit=2000):
     """
     Return all campaigns in the account
     :param limit: limit the results (default is 2000)
     :return: a list of Campaign objects
     """
     campaigns = []
     data = \
         api_get('campaigns', org_id=self.org_id,
                 api_version=self.api_version,
                 limit=limit)['data']
     for raw_campaign in data:
         campaigns.append(Campaign(**raw_campaign))
     return campaigns
 def __init__(self, org_name, api_version='v2'):
     """
     Initialize the API object
     :param org_name: Your organization name as found in the SearchAds interface
     :param api_version: The API version (current is v1)
     """
     self.api_version = api_version
     orgs = api_get("acls", api_version=self.api_version)
     self.org_id = None
     for org in orgs['data']:
         if org['orgName'] == org_name:
             self.org_id = org['orgId']
     if not self.org_id:
         raise Exception("Organization %s does not exist on this account" %
                         org_name)
 def _call(self, endpoint, verbose=False):
     return \
         api_get(endpoint, org_id=self.org_id, api_version=self.api_version,
                 verbose=verbose)['data']