In [1]:
import os
from pynexus import ReportsAPI
from pynexus.settings import APPNEXUS_ACCOUNT
from pynexus.reports.settings import network_analytics_fields, segment_load_fields
# Modify your logs
APPNEXUS_ACCOUNT.update({
'username': "",
'password': ""
})
In [2]:
print("Network analytics: ")
network_analytics_fields
Out[2]:
In [3]:
api = ReportsAPI(**APPNEXUS_ACCOUNT)
In memory
In [9]:
report = api.get_report(network_analytics_fields)
In [10]:
report
Out[10]:
To a file
In [11]:
report = api.save_report(report_name="test", reports_folder=".",
report_fields=network_analytics_fields)
In [12]:
print([x for x in os.listdir() if x.endswith('.csv')])
In [10]:
reports_to_download = {
'report_1': network_analytics_fields,
'report_2': segment_load_fields
}
In memory
In [24]:
reports = api.get_reports(reports_to_download)
In [26]:
reports
Out[26]:
To a file
In [11]:
reports = api.save_reports(reports_to_download,
reports_folder=".",
zip_reports=True,
zip_name="reports")
In [12]:
print([x for x in os.listdir() if x.endswith('.zip')])
In [13]:
reports
Out[13]:
In [ ]: