Skip to content

Commit 403b63b

Browse files
authored
Merge pull request #1 from wechaty/master
merge maste code
2 parents 3c9877c + 36c1298 commit 403b63b

File tree

8 files changed

+34
-17
lines changed

8 files changed

+34
-17
lines changed

.github/workflows/python-app.yml

+4-8
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@ jobs:
2222
python-version: 3.8
2323
- name: Install dependencies
2424
run: |
25-
python -m pip install --upgrade pip
26-
pip install flake8 pytest
27-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
25+
python3 -m pip install --upgrade pip
26+
make install
2827
- name: Lint with flake8
2928
run: |
30-
# stop the build if there are Python syntax errors or undefined names
31-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
32-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
33-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
29+
make lint
3430
- name: Test with pytest
3531
run: |
36-
pytest
32+
make test

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ all: install example
44
.PHONY: install
55
install:
66
pip3 install -r requirements.txt
7+
pip3 install -r requirements-dev.txt
78

89
.PHONY: bot
910
bot:
1011
python3 examples/ding-dong-bot.py
1112

13+
.PHONY: lint
14+
lint:
15+
# stop the build if there are Python syntax errors or undefined names
16+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
17+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
18+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
19+
1220
.PHONY: test
1321
test: pytest
1422

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Wechaty is a RPA SDK for Wechat **Individual** Account that can help you create
1717

1818
1. python3.7+
1919

20+
## Live Coding Video Tutorial
21+
22+
Here's a great live coding video tutorial from our Python Wechaty creator @wj-Mcat: <https://wechaty.js.org/2020/10/26/python-wechaty-live-coding/>
23+
2024
## Quick Start
2125

2226
1. Clone python-wechaty-getting-started repository
@@ -59,8 +63,8 @@ from wechaty import Wechaty
5963
import asyncio
6064
async def main():
6165
bot = Wechaty()
62-
bot.on('scan', lambda status, qrcode, data: print('Scan QR Code to login: {}\nhttps://wechaty.github.io/qrcode/{}'.format(status, qrcode)))
63-
bot.on('login', lambda user: print('User {} logined'.format(user)))
66+
bot.on('scan', lambda status, qrcode, data: print('Scan QR Code to login: {}\nhttps://wechaty.wechaty.js/qrcode/{}'.format(status, qrcode)))
67+
bot.on('login', lambda user: print('User {} logged in'.format(user)))
6468
bot.on('message', lambda message: print('Message: {}'.format(message)))
6569
await bot.start()
6670
asyncio.run(main())

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.14
1+
0.4.15

examples/ding-dong-bot.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
FileBox,
2222
Message,
2323
Wechaty,
24+
ScanStatus,
2425
)
2526

2627

@@ -39,11 +40,16 @@ async def on_message(msg: Message):
3940
await msg.say(file_box)
4041

4142

42-
async def on_scan(qrcode: str, status: int, data):
43+
async def on_scan(
44+
qrcode: str,
45+
status: ScanStatus,
46+
_data,
47+
):
4348
"""
4449
Scan Handler for the Bot
4550
"""
46-
print('Status: ' + status + ', View QR Code Online: https://wechaty.github.io/qrcode/' + qrcode)
51+
print('Status: ' + str(status))
52+
print('View QR Code Online: https://wechaty.js.org/qrcode/' + qrcode)
4753

4854

4955
async def on_login(user: Contact):

requirements-dev.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flake8
2+
pytest

requirements.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
wechaty~=0.6
2-
wechaty-puppet-service~=0.5.0dev
1+
wechaty~=0.7dev15

tests/smoke_testing_test.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
# Iterable,
88
# )
99
from wechaty import (
10-
Wechaty
10+
Wechaty,
11+
Contact,
1112
)
1213

1314

1415
def test_smoke_testing() -> None:
1516
""" wechaty """
1617
# os.environ['WECHATY_PUPPET_SERVICE_TOKEN'] = 'test'
1718
# bot = Wechaty()
18-
assert Wechaty, 'should be imported successfully'
19+
assert Wechaty, 'should be imported successfully for Wechaty'
20+
assert Contact, 'should be imported successfully for Contact'

0 commit comments

Comments
 (0)