python-box:appengine-oauth
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン | 最新のリビジョン両方とも次のリビジョン | ||
python-box:appengine-oauth [2017/05/13 05:52] – [その4. TwitterにOAuthでログインしてTwitter APIを使うデモ] dgbadmin | python-box:appengine-oauth [2017/05/13 05:53] – 以前のリビジョンを復元 (2017/05/13 05:41) dgbadmin | ||
---|---|---|---|
行 48: | 行 48: | ||
+ | ==== その4. TwitterにOAuthでログインしてTwitter APIを使うデモ ==== | ||
+ | [[http:// | ||
+ | |||
+ | ソースコード\\ | ||
+ | (※[[python-box/ | ||
+ | <code python> | ||
# | # | ||
# -*- coding: UTF-8 -*- | # -*- coding: UTF-8 -*- | ||
行 57: | 行 63: | ||
''' | ''' | ||
- | import json | ||
import logging | import logging | ||
- | import | + | import |
from appengine_twitter import AppEngineTwitter | from appengine_twitter import AppEngineTwitter | ||
from basehandler import BaseHandler, | from basehandler import BaseHandler, | ||
+ | from django.utils import simplejson | ||
from google.appengine.ext import db | from google.appengine.ext import db | ||
+ | from google.appengine.ext import webapp | ||
行 128: | 行 135: | ||
# ここまで来ればOAuthを使ってAPIが使える。試しにユーザー名を取得 | # ここまで来ればOAuthを使ってAPIが使える。試しにユーザー名を取得 | ||
twitter.verify() | twitter.verify() | ||
- | name = json.loads(twitter.last_response.content)[' | + | name = simplejson.loads(twitter.last_response.content)[' |
self.demo_header() | self.demo_header() | ||
行 169: | 行 176: | ||
routing = [('/ | routing = [('/ | ||
| | ||
- | application = webapp2.WSGIApplication(routing, | + | application = webapp.WSGIApplication(routing, |
+ | wsgiref.handlers.CGIHandler().run(application) | ||
+ | </ | ||
+ | |||
===== AppEngine-OAuthのソースコード ===== | ===== AppEngine-OAuthのソースコード ===== |
python-box/appengine-oauth.txt · 最終更新: 2017/05/13 05:54 by dgbadmin