WeChat public account token verification problem

In setting up the basic configuration of the WeChat background, we need to define a token (Token) to verify with the server. During the verification process, we need to keep the server with the token werobot running.
The simplest program is as follows (the function of this program is to automatically reply to the message "Welcome to follow me" when the reader subscribes):

import werobot
robot = werobot.WeRoBot(token='your token')

@robot.subscribe
def hello(message):
	return '欢迎关注我!'

robot.config['HOST'] = '0.0.0.0'
robot.config['PORT'] = 80
robot.run()

Suppose we name this program "werobot_test.py", and then we enter the running code in the operating system of the service:

sudo python3 werobot_test.py

We can get the following information, indicating successful operation.
Insert picture description here
At this time, we then enter the background of the WeChat public account, and enter the URL information of the server (note that the url starts with http: //) and the token (same as the token value entered in the python program) into the corresponding content. Then click Submit to complete the verification and enable it!
Insert picture description here
Insert picture description here

Published 273 original articles · praised 40 · 30,000+ views

Guess you like

Origin blog.csdn.net/weixin_41855010/article/details/105550902