Skip to content

Commit 205e73a

Browse files
committed
Cleanup of samples including adding flags to control logging.
1 parent fa6630c commit 205e73a

14 files changed

Lines changed: 84 additions & 53 deletions

File tree

apiclient/discovery.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def build(serviceName, version,
114114
try:
115115
service = simplejson.loads(content)
116116
except ValueError, e:
117+
logging.error('Failed to parse as JSON: ' + content)
117118
raise InvalidJsonError()
118119

119120
fn = os.path.join(os.path.dirname(__file__), 'contrib',

apiclient/model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
FLAGS = gflags.FLAGS
2323

2424
gflags.DEFINE_boolean('dump_request_response', False,
25-
'Dump all http server requests and responses.')
25+
'Dump all http server requests and responses. '
26+
'Must use apiclient.model.LoggingJsonModel as '
27+
'the model.'
28+
)
2629

2730

2831
def _abstract():

oauth2client/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ def _refresh(self, http_request):
192192
'user-agent': self.user_agent,
193193
'content-type': 'application/x-www-form-urlencoded'
194194
}
195+
logging.info("Refresing access_token")
195196
resp, content = http_request(
196197
self.token_uri, method='POST', body=body, headers=headers)
197198
if resp.status == 200:
@@ -218,6 +219,8 @@ def _refresh(self, http_request):
218219
self._invalid = True
219220
if self.store is not None:
220221
self.store(self)
222+
else:
223+
logging.warning("Unable to store refreshed credentials, no Storage provided.")
221224
except:
222225
pass
223226
raise AccessTokenRefreshError(error_msg)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../gflags.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../gflags_validators.py

samples/django_sample/buzz/views.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ def index(request):
5050
def auth_return(request):
5151
try:
5252
f = Flow.objects.get(id=request.user)
53-
print f
54-
print f.flow
55-
print dir(f.flow)
56-
print type(f.flow)
5753
credential = f.flow.step2_exchange(request.REQUEST)
5854
c = Credential(id=request.user, credential=credential)
5955
c.save()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../gflags.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../gflags_validators.py

samples/oauth2/appengine/gflags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../gflags.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../gflags_validators.py

0 commit comments

Comments
 (0)