title: Facebook Marketing API - Python to get Insights - User Request Limit Reached
body: <p>So I am trying my best to navigate my way through the Facebook API. I need to crate a script that will download my business' campaign information daily as a csv file so I can use another script to upload the information to our database easily.</p>
  
  <p>I finally have code that works to print the information to the log, but I am reaching the user request limit because I have to call get_insights() for every single campaign individually. I am wondering if anyone knows how to help me make it so I don't have to call the facebook API as often.</p>
  
  <p>What I would like to do if find a field where I can get the daily spend so I don't have to call the API in every iteration of my for campaign loop, but I cannot for the life of me find a way to do so.</p>
  
  <pre><code>#Import all the facebook mumbo jumbo
  from facebookads.api import FacebookAdsApi
  from facebookads.adobjects.adset import AdSet
  from facebookads.adobjects.campaign import Campaign
  from facebookads.adobjects.adsinsights import AdsInsights
  from facebookads.adobjects.adreportrun import AdReportRun
  from facebookads.adobjects.adaccount import AdAccount
  from facebookads.adobjects.business import Business
  import time
  
  #Set the login info
  my_app_id = '****'
  my_app_secret = '****'
  my_access_token = '****'
  
  #Start the connection to the facebook API
  FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
  
  business = Business('****')
  
  #Get all ad accounts on the business account 
  accounts = business.get_owned_ad_accounts(fields=[AdAccount.Field.id])
  
  #iterate through all accounts in the business account
  for account in accounts:
      tempaccount = AdAccount(account[AdAccount.Field.id])
      #get all campaigns in the adaccount
      campaigns = tempaccount.get_campaigns(fields=[Campaign.Field.name,Campaign.Field])
      #iterate trough all the campaigns in the adaccount
      for campaign in campaigns:
          print(campaign[Campaign.Field.name])
          #get the insight info (spend) from each campaign
          campaignsights = campaign.get_insights(params={'date_preset':'yesterday'},fields=[AdsInsights.Field.spend])
          print (campaignsights)
  </code></pre>