def get_events(client_id, af_api_token):
end_date = datetime.datetime.today().date()- datetime.timedelta(1)
start_date = datetime.datetime.today().date() - datetime.timedelta(30)
try:
performancer_report = get_af(start_date=start_date, end_date=end_date, af_client=client_id, af_api_token=af_api_token,
report='partners_by_date_report')
except:
return []
exception_event = ['ARPU', 'Agency/PMD (af_prt)', 'Average eCPI', 'CTR', 'Campaign (c)', 'Clicks',
'Conversion Rate', 'Impressions',
'Installs', 'Loyal Users', 'Loyal Users/Installs', 'Media Source (pid)', 'ROI', 'Sessions',
'Total Cost', 'Total Revenue', 'Date']
exception_event = set(exception_event)
common_events = performancer_report.keys().tolist()
events_list = [s.split(' ')[0] for s in common_events if "(Event counter)" in s]
return events_list