diff --git a/cqwu/__init__.py b/cqwu/__init__.py index 1a9dabd..1bfa1bd 100644 --- a/cqwu/__init__.py +++ b/cqwu/__init__.py @@ -1,2 +1,2 @@ -from . import types, enums +from . import types, enums, errors from .client import Client diff --git a/cqwu/errors/__init__.py b/cqwu/errors/__init__.py new file mode 100644 index 0000000..153ba4f --- /dev/null +++ b/cqwu/errors/__init__.py @@ -0,0 +1,2 @@ +from .auth import * +from .base import * diff --git a/cqwu/methods/auth/login_with_password.py b/cqwu/methods/auth/login_with_password.py index 9f02cd8..1118638 100644 --- a/cqwu/methods/auth/login_with_password.py +++ b/cqwu/methods/auth/login_with_password.py @@ -37,7 +37,9 @@ class LoginWithPassword: } # 是否需要验证码 if not captcha_code: - form_data['captchaResponse'] = await self.check_captcha(show_qrcode=show_qrcode) + captcha_code = await self.check_captcha(show_qrcode=show_qrcode) + if captcha_code: + form_data['captchaResponse'] = captcha_code # 登录 headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', diff --git a/requirements.txt b/requirements.txt index 56148c6..dfa27c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ httpx==0.23.3 -lxml==4.9.1 +lxml==4.9.2 PyExecJS2==1.6.1 beautifulsoup4==4.11.2 qrcode==7.4.2 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..66a70bb --- /dev/null +++ b/setup.py @@ -0,0 +1,31 @@ +import setuptools # 导入setuptools打包工具 + +with open("README.md", "r", encoding="utf-8") as fh: + long_description = fh.read() + +setuptools.setup( + name="cqwu", # 用自己的名替换其中的YOUR_USERNAME_ + version="0.0.2", # 包版本号,便于维护版本 + author="omg-xtao", # 作者,可以写自己的姓名 + author_email="xtao@xtaolink.cn", # 作者联系方式,可写自己的邮箱地址 + description="A cqwu ehall client.", # 包的简述 + long_description=long_description, # 包的详细介绍,一般在README.md文件内 + long_description_content_type="text/markdown", + url="https://github.com/cqwu-ehall/cqwu-ehall", # 自己项目地址,比如github的项目地址 + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + python_requires='>=3.6', # 对python的最低版本要求 + install_requires=[ + "httpx==0.23.3", + "lxml==4.9.2", + "PyExecJS2==1.6.1", + "beautifulsoup4==4.11.2", + "qrcode==7.4.2", + "pillow", + "pydantic==1.10.5", + ], +)