def main(argv): # Initialize the Analytics Service Object service = analytics_auth.initialize_service() try: results = get_results(service) print_data_table(results) #print_results(results) except TypeError, error: # Handle errors in constructing a query. print ('There was an error in constructing your query : %s' % error)
def main(argv): # Initialize the Analytics Service Object service = analytics_auth.initialize_service() try: # Query APIs, print results profile_id = get_profile_id(service) if profile_id: results = get_results(service, profile_id) print_results(results) 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 = analytics_auth.initialize_service() try: # Step 2. Get the user's first profile ID. profile_id = get_aitopics_profile_id(service) if profile_id: # Step 3. Query the Core Reporting API. start_date = argv[1] end_date = argv[2] results = get_results(service, profile_id, start_date, end_date) # Step 4. Output the results. print_results(results) 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 = analytics_auth.initialize_service() try: # Step 2. Get the user's first profile ID. profile_id = get_aitopics_profile_id(service) if profile_id: # Step 3. Query the Core Reporting API. start_date = argv[1] end_date = argv[2] results = get_results(service, profile_id, start_date, end_date) # Step 4. Output the results. print_results(results) except TypeError, error: # Handle errors in constructing a query. print('There was an error in constructing your query : %s' % error)
def fetch_urls(storage_file, secrets_file, profile_id, max_results, days, verbosity=0): # Step 1. Get an analytics service object. service = analytics_auth.initialize_service( storage_file=storage_file, secrets_file=secrets_file ) try: if verbosity > 0: print 'Fetching ' + str(max_results) + ' results for the last ' + str(days) + ' days' # Step 3. Query the Core Reporting API. results = get_results( service=service, profile_id=profile_id, max_results=max_results, days=days ) # Step 4. Output the results. return parse_results(results) except TypeError, error: # Handle errors in constructing a query. print ('There was an error in constructing your query : %s' % error)