设为首页收藏本站

Crossin的编程教室

 找回密码
 立即加入
查看: 14648|回复: 1
打印 上一主题 下一主题

红包提醒

[复制链接]

6

主题

0

好友

166

积分

注册会员

Rank: 2

跳转到指定楼层
楼主
发表于 2019-2-2 22:35:26 |只看该作者 |倒序浏览
  1. # coding: utf-8
  2. import itchat
  3. import tkinter.messagebox
  4. import winsound
  5. # import os
  6. # import pygame

  7. def alarm():
  8.     # Windows嗡鸣声
  9.     winsound.Beep(37, 3000)
  10. #     # Mac语音
  11. #     os.system('say "有人发红包了,赶紧去抢啊!红红火火恍恍惚惚哈哈哈哈"')
  12. #     # 播放MP3
  13. #     pygame.mixer.init()
  14. #     track = pygame.mixer.music.load('alarm.mp3')
  15. #     pygame.mixer.music.play()
  16.     tkinter.messagebox.showwarning('重要提醒','有人发红包了!')



  17. @itchat.msg_register('Note', isGroupChat=True)
  18. def get_note(msg):
  19.     if '红包' in msg['Text']:
  20.         print('note:',msg['Text'])
  21.         alarm()

  22. @itchat.msg_register(itchat.content.TEXT, isGroupChat=True)
  23. def _(msg):
  24.     print('text:',msg['Text'])

  25. itchat.auto_login(hotReload=True)
  26. itchat.run()
  27. itchat.logout()

复制代码
  1. Traceback (most recent call last):
  2.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
  3.     chunked=chunked)
  4.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 384, in _make_request
  5.     six.raise_from(e, None)
  6.   File "<string>", line 2, in raise_from
  7.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
  8.     httplib_response = conn.getresponse()
  9.   File "G:\Python\python35\lib\http\client.py", line 1321, in getresponse
  10.     response.begin()
  11.   File "G:\Python\python35\lib\http\client.py", line 296, in begin
  12.     version, status, reason = self._read_status()
  13.   File "G:\Python\python35\lib\http\client.py", line 257, in _read_status
  14.     line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  15.   File "G:\Python\python35\lib\socket.py", line 589, in readinto
  16.     return self._sock.recv_into(b)
  17.   File "G:\Python\python35\lib\ssl.py", line 1052, in recv_into
  18.     return self.read(nbytes, buffer)
  19.   File "G:\Python\python35\lib\ssl.py", line 911, in read
  20.     return self._sslobj.read(len, buffer)
  21. ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

  22. During handling of the above exception, another exception occurred:

  23. Traceback (most recent call last):
  24.   File "G:\Python\python35\lib\site-packages\requests\adapters.py", line 449, in send
  25.     timeout=timeout
  26.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
  27.     _stacktrace=sys.exc_info()[2])
  28.   File "G:\Python\python35\lib\site-packages\urllib3\util\retry.py", line 398, in increment
  29.     raise MaxRetryError(_pool, url, error or ResponseError(cause))
  30. urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='wx2.qq.com', port=443): Max retries exceeded with url: /cgi-bin/mmwebwx-bin/webwxsync?sid=LwxWFEQn4p4uhsn+&skey=@crypt_ff6d3ee_f08fccb8288070191159a29e88b3d5d4&pass_ticket=AzJsbONuPu3ZNmQd9%2BLUAC0S0yygdupk7CRcEaQ1nss5DQ8wvwB0Bcbh%2BEykeDSm (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)))

  31. During handling of the above exception, another exception occurred:

  32. Traceback (most recent call last):
  33.   File "G:\Python\python35\lib\site-packages\itchat\components\login.py", line 237, in maintain_loop
  34.     msgList, contactList = self.get_msg()
  35.   File "G:\Python\python35\lib\site-packages\itchat\components\login.py", line 302, in get_msg
  36.     r = self.s.post(url, data=json.dumps(data), headers=headers)
  37.   File "G:\Python\python35\lib\site-packages\requests\sessions.py", line 581, in post
  38.     return self.request('POST', url, data=data, json=json, **kwargs)
  39.   File "G:\Python\python35\lib\site-packages\requests\sessions.py", line 533, in request
  40.     resp = self.send(prep, **send_kwargs)
  41.   File "G:\Python\python35\lib\site-packages\requests\sessions.py", line 646, in send
  42.     r = adapter.send(request, **kwargs)
  43.   File "G:\Python\python35\lib\site-packages\requests\adapters.py", line 510, in send
  44.     raise ProxyError(e, request=request)
  45. requests.exceptions.ProxyError: HTTPSConnectionPool(host='wx2.qq.com', port=443): Max retries exceeded with url: /cgi-bin/mmwebwx-bin/webwxsync?sid=LwxWFEQn4p4uhsn+&skey=@crypt_ff6d3ee_f08fccb8288070191159a29e88b3d5d4&pass_ticket=AzJsbONuPu3ZNmQd9%2BLUAC0S0yygdupk7CRcEaQ1nss5DQ8wvwB0Bcbh%2BEykeDSm (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)))

  46. Traceback (most recent call last):
  47.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
  48.     chunked=chunked)
  49.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 384, in _make_request
  50.     six.raise_from(e, None)
  51.   File "<string>", line 2, in raise_from
  52.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
  53.     httplib_response = conn.getresponse()
  54.   File "G:\Python\python35\lib\http\client.py", line 1321, in getresponse
  55.     response.begin()
  56.   File "G:\Python\python35\lib\http\client.py", line 296, in begin
  57.     version, status, reason = self._read_status()
  58.   File "G:\Python\python35\lib\http\client.py", line 257, in _read_status
  59.     line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  60.   File "G:\Python\python35\lib\socket.py", line 589, in readinto
  61.     return self._sock.recv_into(b)
  62.   File "G:\Python\python35\lib\ssl.py", line 1052, in recv_into
  63.     return self.read(nbytes, buffer)
  64.   File "G:\Python\python35\lib\ssl.py", line 911, in read
  65.     return self._sslobj.read(len, buffer)
  66. ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

  67. During handling of the above exception, another exception occurred:

  68. Traceback (most recent call last):
  69.   File "G:\Python\python35\lib\site-packages\requests\adapters.py", line 449, in send
  70.     timeout=timeout
  71.   File "G:\Python\python35\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
  72.     _stacktrace=sys.exc_info()[2])
  73.   File "G:\Python\python35\lib\site-packages\urllib3\util\retry.py", line 398, in increment
  74.     raise MaxRetryError(_pool, url, error or ResponseError(cause))
  75. urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='webpush.wx2.qq.com', port=443): Max retries exceeded with url: /cgi-bin/mmwebwx-bin/synccheck?r=1549117899719&skey=%40crypt_ff6d3ee_f08fccb8288070191159a29e88b3d5d4&sid=LwxWFEQn4p4uhsn%2B&uin=2697288210&deviceid=e481114857544419&synckey=1_662763427%7C2_662764203%7C3_662764137%7C11_662764202%7C201_1549117737%7C203_1549117721%7C1000_1549117203%7C1001_1549114636&_=1549117899719 (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)))

  76. During handling of the above exception, another exception occurred:

  77. Traceback (most recent call last):
  78.   File "G:\Python\python35\lib\site-packages\itchat\components\login.py", line 231, in maintain_loop
  79.     i = sync_check(self)
  80.   File "G:\Python\python35\lib\site-packages\itchat\components\login.py", line 283, in sync_check
  81.     r = self.s.get(url, params=params, headers=headers)
  82.   File "G:\Python\python35\lib\site-packages\requests\sessions.py", line 546, in get
  83.     return self.request('GET', url, **kwargs)
  84.   File "G:\Python\python35\lib\site-packages\requests\sessions.py", line 533, in request
  85.     resp = self.send(prep, **send_kwargs)
  86.   File "G:\Python\python35\lib\site-packages\requests\sessions.py", line 646, in send
  87.     r = adapter.send(request, **kwargs)
  88.   File "G:\Python\python35\lib\site-packages\requests\adapters.py", line 510, in send
  89.     raise ProxyError(e, request=request)
  90. requests.exceptions.ProxyError: HTTPSConnectionPool(host='webpush.wx2.qq.com', port=443): Max retries exceeded with url: /cgi-bin/mmwebwx-bin/synccheck?r=1549117899719&skey=%40crypt_ff6d3ee_f08fccb8288070191159a29e88b3d5d4&sid=LwxWFEQn4p4uhsn%2B&uin=2697288210&deviceid=e481114857544419&synckey=1_662763427%7C2_662764203%7C3_662764137%7C11_662764202%7C201_1549117737%7C203_1549117721%7C1000_1549117203%7C1001_1549114636&_=1549117899719 (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)))

复制代码
微信收到红包,电脑没有提示,这是被拒绝访问了吗
回复

使用道具 举报

174

主题

45

好友

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

沙发
发表于 2019-2-3 22:57:26 |只看该作者
https://github.com/littlecodersh/ItChat/issues/90
项目里也有人问过,作者说可能是网络问题
我觉得你也检查下是不是电脑开了代理之类
#==== Crossin的编程教室 ====#
微信ID:crossincode
网站:http://crossincode.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

QQ|手机版|Archiver|Crossin的编程教室 ( 苏ICP备15063769号  

GMT+8, 2024-11-24 18:07 , Processed in 0.038105 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部