File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,5 +4,9 @@ runtime: python
44api_version : 1
55
66handlers :
7+ - url : /static
8+ static_dir : static
9+
710- url : .*
811 script : main.py
12+
Original file line number Diff line number Diff line change 1919
2020
2121import httplib2
22+ import logging
2223import os
2324
2425from apiclient .discovery import build
3334from google .appengine .ext .webapp import util
3435from google .appengine .ext .webapp .util import login_required
3536
36- STEP2_URI = 'http://m-buzz .appspot.com/auth_return'
37+ STEP2_URI = 'http://%s .appspot.com/auth_return' % os . environ [ 'APPLICATION_ID' ]
3738
3839
3940class Flow (db .Model ):
@@ -57,9 +58,15 @@ def get(self):
5758 http = c .credentials .authorize (http )
5859 p = build ("buzz" , "v1" , http = http )
5960 activities = p .activities ()
60- activitylist = activities .list (scope = '@self' , userId = '@me' )
61+ activitylist = activities .list (scope = '@consumption' , userId = '@me' )
62+ logging .info (activitylist )
6163 path = os .path .join (os .path .dirname (__file__ ), 'welcome.html' )
62- self .response .out .write (template .render (path , activitylist ))
64+ logout = users .create_logout_url ('/' )
65+ self .response .out .write (
66+ template .render (
67+ path , {'activitylist' : activitylist ,
68+ 'logout' : logout
69+ }))
6370 else :
6471 flow = FlowThreeLegged (buzz_discovery ,
6572 consumer_key = 'anonymous' ,
Original file line number Diff line number Diff line change 11< html >
22 < head >
33 < title > Buzz Stuff</ title >
4+ < style type =text/css >
5+ td { vertical-align : top; padding : 0.5em }
6+ img { border : 0 }
7+ </ style >
48 </ head >
59 < body >
6-
7- < ul >
8- {% for item in items %}
9- < li > {{ item.object.content }}</ li >
10+ < p > < a href ="{{ logout }} "> Logout</ a > </ p >
11+ < table border =0 >
12+ {% for item in activitylist.items %}
13+ < tr valign =top >
14+ < td >
15+ < a href ="{{ item.actor.profileUrl }} "> < img
16+ src ="{{ item.actor.thumbnailUrl }} "> </ a > < br >
17+ < a href ="{{ item.actor.profileUrl }} "> {{ item.actor.name }}</ a > </ td >
18+ < td >
19+ {{ item.object.content }}
20+ </ td >
21+ < td >
22+ < a href ="{{ item.object.links.alternate.0.href }} "> < img
23+ src ="/static/go.png "> </ a >
24+ </ td >
25+ </ tr >
1026 {% endfor %}
11- </ ul >
27+ </ table >
1228 </ body >
1329</ html >
You can’t perform that action at this time.
0 commit comments