try:
    argv = FLAGS(argv)
except gflags.FlagsError as e:
    print('%s\nUsage: %s ARGS\n%s' % (e, argv[0], FLAGS))
sys.exit(1)
logging.getLogger().setLevel(getattr(logging, FLAGS.logging_level))
Google Analytics API access without local browser in python