Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

micli list 提示登录 ssl证书有误 #41

Closed
zlc000190 opened this issue Mar 2, 2023 · 22 comments
Closed

micli list 提示登录 ssl证书有误 #41

zlc000190 opened this issue Mar 2, 2023 · 22 comments

Comments

@zlc000190
Copy link

Cannot connect to host account.xiaomi.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')]

@yihong0618
Copy link
Owner

check your network it should not include proxy

@zlc000190
Copy link
Author

vpn关闭了 还是不行

@zlc000190
Copy link
Author

代理都关闭也不行,查了很多,说是Charles 关闭。 我都没开Charles 还有代理检查已经 查出没用代理了。还是不行。 证书问题吗? 这个就不知道怎么弄了

@pjq
Copy link
Collaborator

pjq commented Mar 3, 2023

本地命令行能打开吗

curl -vv account.xiaomi.com

@pjq
Copy link
Collaborator

pjq commented Mar 3, 2023

这个提示就是MITM, 中间证书被拦截了, CERTIFICATE_VERIFY_FAILED, 如果Mac的, 看一下设置
image

@zlc000190
Copy link
Author

@pjq 好的,非常感谢,mac 我试一下

@zlc000190
Copy link
Author

代理设置这里我之前查看过了,都是关闭的。 curl -vv account.xiaomi.com 运行后的结果 看来,有个 TCP_NODELAY set

 curl -vv account.xiaomi.com

  •   Trying 123.125.102.21...
  • TCP_NODELAY set
  • Connected to account.xiaomi.com (123.125.102.21) port 80 (#0)

GET / HTTP/1.1
Host: account.xiaomi.com
User-Agent: curl/7.64.1
Accept: /
 
< HTTP/1.1 301 Moved Permanently
< Server: Server
< Date: Fri, 03 Mar 2023 07:36:07 GMT
< Content-Type: text/html
< Content-Length: 238
< Connection: keep-alive
< Location: https://account.xiaomi.com/

<title>301 Moved Permanently</title>

301 Moved Permanently


Powered by Server
tengine * Connection #0 to host account.xiaomi.com left intact * Closing connection 0

@zlc000190
Copy link
Author

这是代理的设置

image

@pjq
Copy link
Collaborator

pjq commented Mar 3, 2023

看你的设置好像没什么问题

@zlc000190
Copy link
Author

@pjq 是啊,我检查了但是就是一直报这个错

@joe12801
Copy link

joe12801 commented Mar 6, 2023

我根你一样,都有这个问题

@zlc000190
Copy link
Author

我解决了这个,但是ChatGPT那个又有问题

@greatbody
Copy link

我解决了这个,但是ChatGPT那个又有问题

求教如何解决的。

@Thxonly
Copy link

Thxonly commented Mar 10, 2023

我解决了这个,但是ChatGPT那个又有问题

求教如何解决的。

试试这个方法:https://github.com/Maxmudjon/Get_MiHome_devices_token

@zlc000190
Copy link
Author

@greatbody 解决ssl 997错误
您可以尝试安装 certifi 库。
你可以像这样用 pip 安装它。
pip install certifi
安装后你可以使用这个命令
/Applications/Python\ 3.10/install\ Certificates.command
只需将 python 版本更改为您在环境中使用的版本
并尝试再次运行您的程序。

这对我有用。

@zlc000190
Copy link
Author

@Thxonly 你这种思路解决了吗 运行成功没

@yihong0618
Copy link
Owner

fixed
run:

pip3 install -U git+https://github.com/yihong0618/MiService

@zs1621
Copy link

zs1621 commented Mar 18, 2023

参考这个 -> aio-libs/aiohttp#955 (comment)

@woiweb
Copy link

woiweb commented May 31, 2023

问题已经解决

Problem solved,you should reinstall the cerfificate,the comman as follow:

Navigate to
cd /Applications/Python\ 3.7/

Click on Install Certificates.command

This should solve it.

refer to:aio-libs/aiohttp#955 (comment)

@amazinghaha
Copy link

强!!!就是这个。

@white586
Copy link

white586 commented Dec 2, 2024

fixed run:

pip3 install -U git+https://github.com/yihong0618/MiService

这个只是pip安装适用吧
我使用了最新的容器,还是报错登录失败。
对于容器使用,有什么建议吗?

Exception on login xxxxxxxxxxxx: Cannot connect to host account.xiaomi.com:443 ssl:False [Connect call failed ('xxxxxxxxxxx', 443)]
xiaogpt | Traceback (most recent call last):
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1091, in _wrap_create_connection
xiaogpt | sock = await aiohappyeyeballs.start_connection(
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
xiaogpt | raise first_exception
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 81, in start_connection
xiaogpt | sock = await _connect_sock(
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 166, in _connect_sock
xiaogpt | await loop.sock_connect(sock, address)
xiaogpt | File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
xiaogpt | return await fut
xiaogpt | File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
xiaogpt | raise OSError(err, f'Connect call failed {address}')
xiaogpt | ConnectionRefusedError: [Errno 111] Connect call failed ('xxxxxxxxxxxx', 443)
xiaogpt |
xiaogpt | The above exception was the direct cause of the following exception:
xiaogpt |
xiaogpt | Traceback (most recent call last):
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/miservice/miaccount.py", line 56, in login
xiaogpt | resp = await self._serviceLogin(f"serviceLogin?sid={sid}&_json=true")
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/miservice/miaccount.py", line 98, in _serviceLogin
xiaogpt | async with self.session.request(
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1359, in aenter
xiaogpt | self._resp: _RetType = await self._coro
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 663, in _request
xiaogpt | conn = await self._connector.connect(
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 563, in connect
xiaogpt | proto = await self._create_connection(req, traces, timeout)
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1032, in _create_connection
xiaogpt | _, proto = await self._create_direct_connection(req, traces, timeout)
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1366, in _create_direct_connection
xiaogpt | raise last_exc
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1335, in _create_direct_connection
xiaogpt | transp, proto = await self._wrap_create_connection(
xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1106, in _wrap_create_connection
xiaogpt | raise client_error(req.connection_key, exc) from exc
xiaogpt | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host account.xiaomi.com:443 ssl:False [Connect call failed ('xxxxxxxxx', 443)]

@yihong0618
Copy link
Owner

fixed run:

pip3 install -U git+https://github.com/yihong0618/MiService

这个只是pip安装适用吧 我使用了最新的容器,还是报错登录失败。 对于容器使用,有什么建议吗?

Exception on login xxxxxxxxxxxx: Cannot connect to host account.xiaomi.com:443 ssl:False [Connect call failed ('xxxxxxxxxxx', 443)] xiaogpt | Traceback (most recent call last): xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1091, in _wrap_create_connection xiaogpt | sock = await aiohappyeyeballs.start_connection( xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection xiaogpt | raise first_exception xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 81, in start_connection xiaogpt | sock = await _connect_sock( xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 166, in _connect_sock xiaogpt | await loop.sock_connect(sock, address) xiaogpt | File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect xiaogpt | return await fut xiaogpt | File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb xiaogpt | raise OSError(err, f'Connect call failed {address}') xiaogpt | ConnectionRefusedError: [Errno 111] Connect call failed ('xxxxxxxxxxxx', 443) xiaogpt | xiaogpt | The above exception was the direct cause of the following exception: xiaogpt | xiaogpt | Traceback (most recent call last): xiaogpt | File "/app/.venv/lib/python3.10/site-packages/miservice/miaccount.py", line 56, in login xiaogpt | resp = await self._serviceLogin(f"serviceLogin?sid={sid}&_json=true") xiaogpt | File "/app/.venv/lib/python3.10/site-packages/miservice/miaccount.py", line 98, in _serviceLogin xiaogpt | async with self.session.request( xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1359, in aenter xiaogpt | self._resp: _RetType = await self._coro xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 663, in _request xiaogpt | conn = await self._connector.connect( xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 563, in connect xiaogpt | proto = await self._create_connection(req, traces, timeout) xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1032, in _create_connection xiaogpt | _, proto = await self._create_direct_connection(req, traces, timeout) xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1366, in _create_direct_connection xiaogpt | raise last_exc xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1335, in _create_direct_connection xiaogpt | transp, proto = await self._wrap_create_connection( xiaogpt | File "/app/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 1106, in _wrap_create_connection xiaogpt | raise client_error(req.connection_key, exc) from exc xiaogpt | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host account.xiaomi.com:443 ssl:False [Connect call failed ('xxxxxxxxx', 443)]

换个网络试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants