how to get insights for all campaigns in single query + Facebook marketing api
<p>I want to write query in Python, I want all campaigns performance details in single request.</p>

<p>how to convert below graph api request in Python Query?</p>

<pre><code>/&lt;version&gt;/act_&lt;ACT_ID&gt;/campaigns?fields=insights.fields(actions_results)
</code></pre>

<p>I'd tried using below queries, but it is wrong idea to send multiple times to send request to Facebook, and also Facebook blocks User for 30 minutes. </p>

<pre><code>fields = [Insights.Field.cpm,
          Insights.Field.cpp]

class Fb_insights(object):

    def __init__(self, app_id, app_secret, access_token):
        FacebookAdsApi.init(app_id, app_secret, access_token)

        # Add after FacebookAdsApi.init
        me = AdUser(fbid='me')
        self.my_account = me.get_ad_accounts()[0]

    def campaign_reports(self, since, until):
        params = {
           'level': Insights.Level.campaign, 
           'time_range': {
                'since': since,
                'until': until,
            },
        }

        for campaign in self.my_account.get_campaigns():
            for stat in campaign.get_insights(fields=fields,
                                                  params=params):
                print(stat)
</code></pre>

<p>Bad thing is I'm sending requests by calling "get_insights()" for each campaign.</p>

<p><strong>UPDATE</strong></p>

<p>I also tried to fetch directly insights, Below code returns only 1 campaign detail while I've 1 active campaigns and 87 Not Delivering campaign, also update <code>level=campaign</code> in params</p>

<pre><code>for insight in self.my_account.get_insights(fields=fields, params=params):
    print insight
</code></pre>

<p><strong><em>Query:</em></strong>  By using my updated code, How can I get all delivered and non-delivered campaigns using single query?</p>