• R/O
  • HTTP
  • SSH
  • HTTPS

pybbs: Commit

無料の掲示板


Commit MetaInfo

Révisionfa99568341509ea30fc47b93ffd2e58e7e4936c9 (tree)
l'heure2018-09-25 21:17:39
Auteur福家 正士 <yamat0jp@yaho...>
Commiter福家 正士

Message de Log

test

Change Summary

Modification

--- a/pybbs.py
+++ b/pybbs.py
@@ -1,7 +1,7 @@
11 # -*- coding:utf-8 -*-
22 import os,re,glob
33 from tornado import escape,web,ioloop,httpserver,httpclient
4-import pymongo
4+import pymongo, urllib
55 from datetime import datetime,date
66 import json
77 from bson.objectid import ObjectId #don't remove
@@ -624,7 +624,8 @@ class WebHookHandler(web.RequestHandler):
624624 te = self.help()
625625 else:
626626 te = self.main(x)
627- linebot = LineBotApi(self.application.token)
627+ token = self.application.db['params'].find_one({'app':'bot'})['access_token']
628+ linebot = LineBotApi(token)
628629 linebot.reply_message(event['replyToken'], TextSendMessage(text=te))
629630
630631 class InitHandler(web.RequestHandler):
@@ -668,10 +669,8 @@ class TokenHandler(web.RequestHandler):
668669 def get(self):
669670 url = 'https://api.line.me/v2/oauth/accessToken'
670671 headers = 'application/x-www-form-urlencoded'
671- grant = 'grant_type=client_credentials'
672- ci = 'client_id='+self.application.id
673- cs = 'client_secret='+self.application.ch
674- body = grant+'&'+ci+'&'+cs
672+ data = {'grant_type':'client_credentials', 'client_id':self.application.id, 'client_secret':self.application.ch}
673+ body = urllib.parse.urlencode(data)
675674 req = httpclient.HTTPRequest(url=url,method='POST',headers=headers,body=body)
676675 http = httpclient.AsyncHTTPClient()
677676 http.fetch(req, callback=self.on_response)
Afficher sur ancien navigateur de dépôt.