-
Notifications
You must be signed in to change notification settings - Fork 88
/
test.py
41 lines (31 loc) · 894 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import omniture
import sys
import os
from pprint import pprint
analytics = omniture.Account()
analytics.authenticate(os.environ)
#print analytics.suites
print analytics.suites['guardiangu-parioli-taste-of-rome']
print analytics.suites['Media Prof Network']
network = analytics.suites['guardiangu-network']
print len(network.evars)
#pprint(network.segments)
print network.segments['First Time Visitors']
segments = [
'UK (Locked)',
'US (Locked)',
]
queue = []
for segment in segments:
report = network.report \
.range('2013-05-01', '2013-05-31', granularity='day') \
.over_time(metrics=['pageviews']) \
.filter(segment=segment)
queue.append(report)
def heartbeat():
sys.stdout.write('.')
sys.stdout.flush()
reports = omniture.sync(queue, heartbeat)
for report in reports:
print report.segment
print report.data['pageviews']