def main()

in python/lookerstudio/lookerstudio_deployment.py [0:0]


def main():
    views_exist = True
    report_url = BASE_URL + 'c.reportId=' + REPORT_ID + '&c.explain=true' + '&r.reportName=' + REPORT_NAME
    # Get sources from config file
    sources = parse_config(CONFIG_FILE)
    
    for source in sources:
        # Get fully qualified view Resource ID and check it exists
        view_id = f"{source['projectId']}.{source['datasetId']}.{source['tableId']}"

        # If view doesn't exist, skip constructing URL and check next view
        if not check_view_exists(view_id):
            views_exist = False
            continue
        
        # Check views_exist, if one does not then don't bother generating urls for remaining sources
        # But continue through loop to continue checking if they are accessible
        if views_exist:
            # View exists so construct url and append to main report_url
            report_url += add_data_source(source)
            
    # If all views do not exist and are not accessible, print error and exit main()
    if not views_exist:
        print('\nAn error ocurred. See error(s) above and try again.')
        sys.exit(1)

    print('Click link to copy report to your account and finish configuring data sources:\n')

    print(report_url)