I am trying to follow the WeChat Official Account tutorial to build an app.
In the step of
1.4 Basic Configuration for Developers
- After the restart is successful (python main.py 80), click the Submit button. If the prompt "token verification failed" appears, check the code or network link. If the token is successfully verified, you will be redirected back to the Basic Configuration page. Click Start.
However, based on the tutorial, there is no submit button related code. I cannot find the submit button.
When I open the pages through WeChat Official Account in the app WeChat, it just shows "hello, this is handle view".
Any guide? Thanks
main.py
import web
from handle import Handle
urls = (
'/wx', 'Handle',
)
if __name__ == '__main__':
app = web.application(urls, globals())
app.run()
handle.py
import hashlib
import web
class Handle(object):
def GET(self):
try:
data = web.input()
if len(data) == 0:
return "hello, this is handle view"
signature = data.signature
timestamp = data.timestamp
nonce = data.nonce
echostr = data.echostr
token = "xxxx" #Enter the value in **Basic Configuration ** at Official Accounts Platform.
list = [token, timestamp, nonce]
list.sort()
sha1 = hashlib.sha1()
map(sha1.update, list)
hashcode = sha1.hexdigest()
print "handle/GET func: hashcode, signature: ", hashcode, signature
if hashcode == signature:
return echostr
else:
return ""
except Exception, Argument:
return Argument
I figured out the submit button here in the tutorial is referring the submit button at
开发 -> 基本配置 -> 服务器配置 -> 修改配置 -> URL
After you fill the URL, that submit (提交) button.
(Unfortunately, the WeChat Official Accounts settings panel only has Mandarin language not like the developer doc. But hopefully my screenshot will help locate it.)