Skip to content
Browse files

添加一些注释

  • Loading branch information...
1 parent b3c16c1 commit 102abe12e38fc8960e0baca6303004ab5acc6e71 @wangxiaomo committed Jun 10, 2012
Showing with 42 additions and 7 deletions.
  1. +24 −0 README
  2. +8 −5 app.py
  3. +10 −2 config.yaml
View
24 README
@@ -0,0 +1,24 @@
+Python SAE Weibo OAuth2 Template.
+ Author: xiaomo(wxm4ever@gmail.com)
+ GitHub: https://github.com/wangxiaomo/py-weibo-oauth2template
+ Fork : https://github.com/wangxiaomo/py-weibo-oauth2template/fork_select
+.
+├── app.py # 应用程序
+├── config.yaml # 配置文件
+├── index.wsgi # 启动文件
+├── README # 文档
+└── weibo.py # weibo python sdk(oauth2)
+
+0 directories, 5 files
+
+
+INSTALL:
+ 1.新建 SAE Python 应用.
+ 2.修改 config.yaml:
+ name: 应用名
+ version: 应用版本
+ 3.修改 app.py:
+ 修改 APP_KEY,APP_SECRET
+ 修改 CALLBACK_URL
+ 修改 app.secret_key(可选)
+
View
13 app.py
@@ -1,10 +1,14 @@
#-*- coding: utf-8 -*-
+""" APP NAME: Python Weibo OAuth2 Template """
+""" Author : xiaomo(wxm4ever@gmail.com) """
+""" Fork : https://github.com/wangxiaomo/py-weibo-oauth2template/fork_select """
-""" CONFIG OF THE APP TOKEN """
-APP_KEY = '2986120742'
-APP_SECRET = '796b90d5a6e3a1cc4d719726f5f99f7d'
+""" CONFIG OF THE APP TOKEN AND CALLBACK_URL """
+APP_KEY = 'APP_KEY'
+APP_SECRET = 'APP_SECRET'
+CALLBACK_URL = 'CALLBACK_URL'
from flask import Flask, g, request, redirect, make_response
@@ -17,10 +21,10 @@
except ImportError:
import simplejson as json
from weibo import APIClient
-CALLBACK_URL = "http://2.irestful.sinaapp.com/callback"
def get_api_client():
+ """ 返回 API Client """
return APIClient(app_key=APP_KEY, app_secret=APP_SECRET, redirect_uri=CALLBACK_URL)
@app.route("/")
@@ -53,7 +57,6 @@ def callback():
client = get_api_client()
r = client.request_access_token(code)
client.set_access_token(r.access_token, r.expires_in)
- # get user info
userid=client.get.account__get_uid()
user=client.get.users__show(uid=userid.uid)
View
12 config.yaml
@@ -1,4 +1,12 @@
+##########################################################
+#
+#
+# APP NAME: Python Weibo OAuth2 Template
+# VERSION : 1.0
+#
+##########################################################
+
---
-name: irestful
-version: 2
+name: APP_NAME # 应用名称
+version: APP_VERSION # 应用版本号
...

0 comments on commit 102abe1

Please sign in to comment.
Something went wrong with that request. Please try again.