summaryrefslogtreecommitdiffstats
path: root/doc/AnalyticsWebReport.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/AnalyticsWebReport.py')
-rwxr-xr-xdoc/AnalyticsWebReport.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/AnalyticsWebReport.py b/doc/AnalyticsWebReport.py
new file mode 100755
index 00000000..1806cab9
--- /dev/null
+++ b/doc/AnalyticsWebReport.py
@@ -0,0 +1,30 @@
+import os
+import sys
+import AnalyticsConnect as ac
+import TRexDataAnalysis as tr
+import time
+import datetime
+
+
+def main(verbose=False, detailed_test_stats=''):
+ if verbose:
+ print('Retrieving data from Google Analytics')
+ analytics = ac.initialize_analyticsreporting()
+ current_date = time.strftime("%Y-%m-%d")
+ k_days_ago = datetime.datetime.now() - datetime.timedelta(days=15)
+ start_date = str(k_days_ago.date())
+ response = ac.get_report(analytics, start_date, current_date)
+ ga_all_data_dict, setups = ac.export_to_tuples(response)
+ dest_path = os.path.join(os.getcwd(), 'build', 'images')
+ if verbose:
+ print('Saving data to %s' % dest_path)
+ if detailed_test_stats:
+ print('generating detailed table for test results')
+ tr.create_all_data(ga_all_data_dict, setups, start_date, current_date, save_path=dest_path,
+ add_stats='yes', detailed_test_stats=detailed_test_stats)
+ if verbose:
+ print('Done without errors.')
+
+
+if __name__ == "__main__":
+ main()