Cleanup of samples including adding flags to control logging.
diff --git a/samples/oauth2/buzz/buzz.py b/samples/oauth2/buzz/buzz.py
index 86ceaf9..74ee3a4 100644
--- a/samples/oauth2/buzz/buzz.py
+++ b/samples/oauth2/buzz/buzz.py
@@ -11,36 +11,47 @@
 
 __author__ = 'jcgregorio@google.com (Joe Gregorio)'
 
+import gflags
 import httplib2
-import pickle
+import logging
 import pprint
+import sys
 
 from apiclient.discovery import build
 from oauth2client.file import Storage
 from oauth2client.client import OAuth2WebServerFlow
 from oauth2client.tools import run
 
-# Uncomment the next line to get very detailed logging
-#httplib2.debuglevel = 4
+FLAGS = gflags.FLAGS
+FLOW = OAuth2WebServerFlow(
+    client_id='433807057907.apps.googleusercontent.com',
+    client_secret='jigtZpMApkRxncxikFpR+SFg',
+    scope='https://www.googleapis.com/auth/buzz',
+    user_agent='buzz-cmdline-sample/1.0')
+
+gflags.DEFINE_enum('logging_level', 'ERROR',
+    ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
+    'Set the level of logging detail.')
 
 
-def main():
+def main(argv):
+  try:
+    argv = FLAGS(argv)
+  except gflags.FlagsError, e:
+    print '%s\\nUsage: %s ARGS\\n%s' % (e, argv[0], FLAGS)
+    sys.exit(1)
+
+  logging.getLogger().setLevel(getattr(logging, FLAGS.logging_level))
+
   storage = Storage('buzz.dat')
   credentials = storage.get()
   if credentials is None or credentials.invalid == True:
-    flow = OAuth2WebServerFlow(
-        client_id='433807057907.apps.googleusercontent.com',
-        client_secret='jigtZpMApkRxncxikFpR+SFg',
-        scope='https://www.googleapis.com/auth/buzz',
-        user_agent='buzz-cmdline-sample/1.0',
-        domain='anonymous',
-        xoauth_displayname='Buzz Client Example App'
-        )
-    credentials = run(flow, storage)
+    credentials = run(FLOW, storage)
 
   http = httplib2.Http()
   http = credentials.authorize(http)
 
+  # Build the Buzz service
   service = build("buzz", "v1", http=http,
             developerKey="AIzaSyDRRpR3GS1F1_jKNNM9HCNd2wJQyPG3oN0")
   activities = service.activities()
@@ -57,13 +68,11 @@
 
   # Add a new activity
   new_activity_body = {
-      "data": {
-          'title': 'Testing insert',
-          'object': {
-              'content':
-                u'Just a short note to show that insert is working. ☄',
-              'type': 'note'}
-          }
+      'title': 'Testing insert',
+      'object': {
+        'content':
+        u'Just a short note to show that insert is working. ☄',
+        'type': 'note'}
       }
   activity = activities.insert(userId='@me', body=new_activity_body).execute()
   print "Added a new activity"
@@ -73,9 +82,7 @@
 
   # Add a comment to that activity
   comment_body = {
-      "data": {
-          "content": "This is a comment"
-          }
+      "content": "This is a comment"
       }
   item = activitylist['items'][0]
   comment = service.comments().insert(
@@ -85,4 +92,4 @@
   pprint.pprint(comment)
 
 if __name__ == '__main__':
-  main()
+  main(sys.argv)