def main(argv): # Step 1. Get an analytics service object. service = auth.initialize_service() try: # Step 2. Get the user's first profile ID. #profile_id = get_first_profile_id(service) profile_id = str(cfg['profile']) print profile_id if profile_id: for sdate in rrule.rrule(rrule.WEEKLY, dtstart=first, until=last): edate = sdate + timedelta(days=6) print "Range is %s through %s" % (sdate.strftime("%Y-%m-%d"), edate.strftime("%Y-%m-%d")) logger.write("Range is %s through %s" % (sdate.strftime("%Y-%m-%d"), edate.strftime("%Y-%m-%d"))) start = 1 while start < 200000: print "Start = %s" % start data = get_data(service, profile_id, sdate.strftime("%Y-%m-%d"), edate.strftime("%Y-%m-%d"), start) store_data(data) print_pagination_info(data) print 'Next Link = %s' % data.get('nextLink') logger.write("Hit Count = %s\n" % data.get('totalResults')) print 'Contains Sampled Data = %s' % data.get('containsSampledData') logger.write("Contains Sampled Data = %s\n\n" % data.get('containsSampledData')) if data.get('nextLink'): start += 10000 else: start = 200000 print_data(counts) except TypeError, error: # Handle errors in constructing a query. print ('There was an error in constructing your query : %s' % error)
def main(argv): # Step 1. Get an analytics service object. service = auth.initialize_service() # Requests a list of all account summaries for the authorized user. try: account_summaries = service.management().accountSummaries().list().execute() print_account_summaries(account_summaries, service) except TypeError, error: # Handle errors in constructing a query. print 'There was an error in constructing your query : %s' % error
def main(argv): # Step 1. Get an analytics service object. service = auth.initialize_service() # Requests a list of all account summaries for the authorized user. try: account_summaries = service.management().accountSummaries().list( ).execute() print_account_summaries(account_summaries, service) except TypeError, error: # Handle errors in constructing a query. print 'There was an error in constructing your query : %s' % error
def main(argv): # Step 1. Get an analytics service object. service = auth.initialize_service() try: # Step 2. Get the user's first profile ID. #profile_id = get_first_profile_id(service) profile_id = str(cfg['profile']) print profile_id if profile_id: for sdate in rrule.rrule(rrule.WEEKLY, dtstart=first, until=last): edate = sdate + timedelta(days=6) print "Range is %s through %s" % (sdate.strftime("%Y-%m-%d"), edate.strftime("%Y-%m-%d")) logger.write( "Range is %s through %s" % (sdate.strftime("%Y-%m-%d"), edate.strftime("%Y-%m-%d"))) start = 1 while start < 200000: print "Start = %s" % start data = get_data(service, profile_id, sdate.strftime("%Y-%m-%d"), edate.strftime("%Y-%m-%d"), start) store_data(data) print_pagination_info(data) print 'Next Link = %s' % data.get('nextLink') logger.write("Hit Count = %s\n" % data.get('totalResults')) print 'Contains Sampled Data = %s' % data.get( 'containsSampledData') logger.write("Contains Sampled Data = %s\n\n" % data.get('containsSampledData')) if data.get('nextLink'): start += 10000 else: start = 200000 print_data(counts) except TypeError, error: # Handle errors in constructing a query. print('There was an error in constructing your query : %s' % error)