├── .gitignore ├── README.md ├── config.yaml ├── index.wsgi └── robot.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | build 11 | eggs 12 | parts 13 | bin 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | 21 | # Installer logs 22 | pip-log.txt 23 | 24 | # Unit test / coverage reports 25 | .coverage 26 | .tox 27 | nosetests.xml 28 | 29 | # Translations 30 | *.mo 31 | 32 | # Mr Developer 33 | .mr.developer.cfg 34 | .project 35 | .pydevproject 36 | 37 | .DS_Store 38 | .idea 39 | 40 | lib/ 41 | include/ 42 | .Python 43 | 44 | site-packages/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WeRoBot-SAE-demo 2 | ================ 3 | 4 | 使用 5 | ------ 6 | ```bash 7 | git clone git://github.com/whtsky/WeRoBot-SAE-demo.git 8 | cd WeRoBot-SAE-demo 9 | virtualenv --no-site-packages . 10 | source bin/activate 11 | pip install sae-python-dev 12 | saecloud install werobot 13 | ``` 14 | 15 | 然后编辑 `config.yaml` 文件,更改 `name` 。 16 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | name: CHANGE_THIS 2 | worker: wsgi 3 | version: 1 -------------------------------------------------------------------------------- /index.wsgi: -------------------------------------------------------------------------------- 1 | import sae 2 | from robot import robot 3 | 4 | 5 | application = sae.create_wsgi_app(robot.wsgi) 6 | -------------------------------------------------------------------------------- /robot.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | root = os.path.dirname(__file__) 5 | 6 | sys.path.insert(0, os.path.join(root, 'site-packages')) 7 | 8 | import werobot 9 | 10 | robot = werobot.WeRoBot(token='tokenhere') 11 | 12 | 13 | @robot.handler 14 | def echo(message): 15 | return 'Hello World!' 16 | --------------------------------------------------------------------------------