Skip to content

Instantly share code, notes, and snippets.

View Rperry2174's full-sized avatar

Ryan Perry Rperry2174

View GitHub Profile
# This would simulate a CPU running for 0.8 seconds
def foo():
# work(75000)
work(8000)
# This would simulate a CPU running for 2.5 seconds
def bar():
work(25000)
# where each iteration simulates CPU time
def work(n):
i = 0
while i < n:
i += 1
# This would simulate a CPU running for 7.5 seconds
def foo():
work(75000)
@Rperry2174
Rperry2174 / facebook_ad_campaign_results.py
Created October 21, 2020 01:16
Facebook add campaign results
from facebook_business.objects import AdCampaign
campaign = AdCampaign('<AD_CAMPAIGN_ID>')
params = {
'date_preset': AdCampaign.Preset.last_7_days,
}
insights = campaign.get_insights(params=params)
print insights