Moved OAuth discovery data into future.json
diff --git a/samples/cmdline/buzz.py b/samples/cmdline/buzz.py
index b71f400..de871eb 100644
--- a/samples/cmdline/buzz.py
+++ b/samples/cmdline/buzz.py
@@ -19,7 +19,7 @@
def main():
- f = open("oauth_token.dat", "r")
+ f = open("buzz.dat", "r")
credentials = pickle.loads(f.read())
f.close()
diff --git a/samples/cmdline/moderator.py b/samples/cmdline/moderator.py
new file mode 100644
index 0000000..3bca162
--- /dev/null
+++ b/samples/cmdline/moderator.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python2.4
+# -*- coding: utf-8 -*-
+#
+# Copyright 2010 Google Inc. All Rights Reserved.
+
+"""Simple command-line example for Buzz.
+
+Command-line application that retrieves the users
+latest content and then adds a new entry.
+"""
+
+__author__ = 'jcgregorio@google.com (Joe Gregorio)'
+
+
+from apiclient.discovery import build
+
+import httplib2
+import pickle
+
+
+def main():
+ f = open("moderator.dat", "r")
+ credentials = pickle.loads(f.read())
+ f.close()
+
+ http = httplib2.Http()
+ http = credentials.authorize(http)
+
+ p = build("moderator", "v1", http=http)
+ print p.submissions().list(seriesId="7035", topicId="64")
+
+if __name__ == '__main__':
+ main()
diff --git a/samples/cmdline/three_legged_dance.py b/samples/cmdline/three_legged_dance.py
index 7cafb97..9972455 100644
--- a/samples/cmdline/three_legged_dance.py
+++ b/samples/cmdline/three_legged_dance.py
@@ -22,11 +22,13 @@
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
-from apiclient.oauth import buzz_discovery
+from apiclient.discovery import build
from apiclient.oauth import FlowThreeLegged
import pickle
+buzz_discovery = build("buzz", "v1").auth_discovery()
+
flow = FlowThreeLegged(buzz_discovery,
consumer_key='anonymous',
consumer_secret='anonymous',
@@ -48,6 +50,6 @@
credentials = flow.step2_exchange(verification)
-f = open('oauth_token.dat', 'w')
+f = open('buzz.dat', 'w')
f.write(pickle.dumps(credentials))
f.close()
diff --git a/samples/cmdline/three_legged_dance_moderator.py b/samples/cmdline/three_legged_dance_moderator.py
new file mode 100644
index 0000000..f09410d
--- /dev/null
+++ b/samples/cmdline/three_legged_dance_moderator.py
@@ -0,0 +1,55 @@
+# Copyright (C) 2010 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Do the OAuth 1.0a three legged dance.
+
+Do the OAuth 1.0a three legged dance for
+a Buzz command line application. Store the generated
+credentials in a common file that is used by
+other example apps in the same directory.
+"""
+
+__author__ = 'jcgregorio@google.com (Joe Gregorio)'
+
+from apiclient.discovery import build
+from apiclient.oauth import FlowThreeLegged
+
+import pickle
+
+moderator_discovery = build("moderator", "v1").auth_discovery()
+
+flow = FlowThreeLegged(moderator_discovery,
+ consumer_key='anonymous',
+ consumer_secret='anonymous',
+ user_agent='google-api-client-python-mdrtr-cmdline/1.0',
+ domain='anonymous',
+ scope='https://www.googleapis.com/auth/moderator',
+ xoauth_displayname='Google API Client Example App')
+
+authorize_url = flow.step1_get_authorize_url()
+
+print 'Go to the following link in your browser:'
+print authorize_url
+print
+
+accepted = 'n'
+while accepted.lower() == 'n':
+ accepted = raw_input('Have you authorized me? (y/n) ')
+verification = raw_input('What is the verification code? ').strip()
+
+credentials = flow.step2_exchange(verification)
+
+f = open('moderator.dat', 'w')
+f.write(pickle.dumps(credentials))
+f.close()