# make topics for udata
udata[ 'topics' ] = []
tmp = client.get.statuses__friends_timeline( count = 50, page = 1 )
for topic in tmp['statuses']:
retweet = {}
try:
retweet = { \
'screen_name': topic['retweeted_status']['user']['screen_name'],
'text' : topic['retweeted_status']['text'],
}
except: pass
udata[ 'topics' ].append({ \
'screen_name': topic['user']['screen_name'],
'avatar_url': topic['user']['profile_image_url'],
'text': topic['text'],
'thumbnail_pic':topic.get('thumbnail_pic'),
'retweet': retweet,
})
return render.index( udata )
$def with (user)
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>$user['screen_name'] 的微新報</title>
<style type="text/css">
body {
background-color:#b0c4de;
}
div {
display: block;
}
</style>
</head>
<body>
<div id="head">
<img src="$(user['avatar_url'])" />
$user['screen_name'] : $user['lats_weibo']
</div>
<div id="topic_container">
$for topic in user['topics']:
<dl class="$loop.parity">
<dt id="avatar">
<span><img src="$(topic['avatar_url'])" /></span>
<span>
$topic['screen_name'] :$topic['text']
<img src="$(topic['thumbnail_pic'])" />
</span>
</dt>
</dd>
$if topic['retweet']:
<dd id="retweet">
$topic['retweet']['screen_name'] :$topic['retweet']['text']
</dd>
</dl>
</div>
</body>
</html>