Skip to content

Commit

Permalink
pillow包不再强制
Browse files Browse the repository at this point in the history
  • Loading branch information
yjqiang committed Apr 23, 2019
1 parent 5001748 commit 155c420
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions reqs/login.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import base64
from PIL import Image
from io import BytesIO
try:
from PIL import Image
except ImportError:
Image = None
import requests
from .utils import UtilsReq

Expand Down Expand Up @@ -71,8 +74,10 @@ def cnn_captcha(content):

@staticmethod
def input_captcha(content):
img = Image.open(BytesIO(content))
# img.thumbnail(size)
img.show()
captcha = input('手动输入验证码')
if Image is not None:
img = Image.open(BytesIO(content))
img.show()
captcha = input('请手动输入验证码:')
else:
captcha = input('您并没有安装pillow模块,但仍然选择了手动输入,那就输呀:')
return captcha
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ rsa
attrs
aiohttp
toml
Pillow
# Pillow 当你需要自己输入验证码的时候请安装
decorator

0 comments on commit 155c420

Please sign in to comment.