ehForwarderBot / efb-telegram-master

EFB Telegram Master Channel, a channel for EH Forwarder Bot.
GNU Affero General Public License v3.0
223 stars 79 forks source link

No prompt, no retry when ETM times out while sending file #4

Closed blueset closed 6 years ago

blueset commented 6 years ago

From @blueset on November 9, 2017 10:37

Log ``` 2017-11-09 10:28:54,822: itchat [DEBUG] No uins in 51 message 2017-11-09 10:28:54,823: itchat [DEBUG] 2017-11-09 10:28:54,823: plugins.eh_wechat_slave.WeChatChannel [DEBUG] WeChat "System" message: , 'UserName': 'filehelper'}>, 'Type': 'System', 'ImgHeight': 0, 'ForwardFlag': 0, 'StatusNotifyCode': 2, 'RecommendInfo': {'Alias': '', 'AttrStatus': 0, 'QQNum': 0, 'NickName': '', 'Content': '', 'Sex': 0, 'City': '', 'Ticket': '', 'Scene': 0, 'VerifyFlag': 0, 'OpCode': 0, 'Province': '', 'Signature': '', 'UserName': ''}, 'FileSize': '', 'MsgType': 51, 'MsgId': '5125997940070499124', 'NewMsgId': 5125997940070499124, 'VoiceLength': 0, 'CreateTime': 1510223334, 'OriContent': '', 'MediaId': '', 'Text': [], 'StatusNotifyUserName': 'filehelper', 'ToUserName': 'filehelper'}> 2017-11-09 10:29:00,129: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG] Raw message: \n\n\t\n\t\tcomplete-info20003-database-systems-subject-notes.pdf\n\t\t\n\t\t\n\t\tview\n\t\t6\n\t\t0\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t0\n\t\t\n\t\t\t\n\t\t\t0\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t2183828\n\t\t\t@cdn_30590201000452305002010002041eab456502030f52590204c394cdcb02045a042d40042b6175706174746163685f363238303562613137353139393064645f313531303232333136363839325f31300204010c00050201000400_d00a1b50fe924d6f86807e2777311dfb_1\n\t\t\t30590201000452305002010002041eab456502030f52590204c394cdcb02045a042d40042b6175706174746163685f363238303562613137353139393064645f313531303232333136363839325f31300204010c00050201000400\n\t\t\t\n\t\t\td00a1b50fe924d6f86807e2777311dfb\n\t\t\tpdf\n\t\t\t0\n\t\t\n\t\t\n\t\t3\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t0\n\t\t\t\n\t\t\n\t\t\n\t\t\t0\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t0\n\t\t\tnull\n\t\t\tnull\n\t\t\n\t\t\n\t\t\t0\n\t\t\tnull\n\t\t\tnull\n\t\t\tnull\n\t\t\t\n\t\t\t0\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t0\n\t\tGhQKEnd4NjYxOGYxY2ZjNmMxMzJmOA==\n\t\t9f8bf94a54db4094a5596e14ac1b165c\n\t\n\tblueset\n\t0\n\t\n\t\t7\n\t\t微信电脑版\n\t\n\t\n\n', 'FileName': 'complete-info20003-database-systems-subject-notes.pdf', 'AppInfo': {'Type': 0, 'AppID': 'wx6618f1cfc6c132f8'}, 'ImgWidth': 0, 'Ticket': '', 'FromUserName': '@4cbf265ac22d857f11523b24730b0a2b', 'AppMsgType': 6, 'SubMsgType': 0, 'HasProductId': 0, 'User': , 'UserName': 'filehelper'}>, 'Type': 'Attachment', 'ImgHeight': 0, 'ForwardFlag': 0, 'StatusNotifyCode': 0, 'RecommendInfo': {'Alias': '', 'AttrStatus': 0, 'QQNum': 0, 'NickName': '', 'Content': '', 'Sex': 0, 'City': '', 'Ticket': '', 'Scene': 0, 'VerifyFlag': 0, 'OpCode': 0, 'Province': '', 'Signature': '', 'UserName': ''}, 'FileSize': '2183828', 'MsgType': 49, 'MsgId': '511218672271321680', 'NewMsgId': 511218672271321680, 'VoiceLength': 0, 'CreateTime': 1510223339, 'OriContent': '', 'MediaId': '@crypt_6a80f494_7569bf0780148248ea33855c99e082337bed75ccabb3321e8765c06e33f9bf0d1d142386f75843341b80f8f389f2a124bd928aeae4b549b7f7223cc8cb9078152a0c33b3ec3a685d516fe0741c0c3ddaff4feccf6af246cab315e06b58ba7a32d85dbc8fae405e2810b5793bb32e3bac5a1b117159b302de716334634b20147564cb0a9cf0015729a65cddcc7776cf21bb16dcdee283eb01656505de4c21b26c4558061ea760caa0d385489783e2a5ccdcf9e65bcf62a60f8f9a7cdfe4d5ec34abe009dd1394b824010e766f2651d57cb940ece5decbbb45d49acd7fb78eaa03', 'Text': .download_atta at 0x7f04300821e0>, 'StatusNotifyUserName': '', 'ToUserName': 'filehelper'}> 2017-11-09 10:29:01,436: plugins.eh_wechat_slave.WeChatChannel [INFO] File saved from WeChat Full path: storage/eh_wechat_slave/File_511218672271321680_1510223340.pdf MIME: application/pdf 2017-11-09 10:29:01,436: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG] me, True 2017-11-09 10:29:01,436: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG] From user, {'Uin': 'filehelper', 'RemarkName': 'System (filehelper)', 'UserName': 'filehelper', 'NickName': 'System (filehelper)'} 2017-11-09 10:29:01,450: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG] dest: {'alias': '\u2006', 'name': '\u2006', 'uid': '1786733442'} 2017-11-09 10:29:01,450: plugins.eh_wechat_slave.wechat_msg_meta [INFO] WeChat incoming message: Type: File Text: .download_atta at 0x7f04300821e0> UserName: filehelper uid: filehelper name: System (filehelper) 2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [INFO] Got message from queue Type: File Text: You: complete-info20003-database-systems-subject-notes.pdf ---- 2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [DEBUG] 1510223341.451574, Msg text: You: complete-info20003-database-systems-subject-notes.pdf 2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [INFO] Msg sent to TG, task_done marked. 2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [DEBUG] 1510223341.451574, process_msg_step_0 2017-11-09 10:29:01,452: peewee [DEBUG] ('SELECT "t1"."id", "t1"."master_uid", "t1"."slave_uid" FROM "chatassoc" AS t1 WHERE ("t1"."slave_uid" = ?)', ['eh_wechat_slave.filehelper']) 2017-11-09 10:29:01,453: plugins.eh_telegram_master.TelegramChannel [DEBUG] 1510223341.451574, process_msg_step_1, tg_dest=57995782, msg.origin={'alias': 'System (filehelper)', 'name': 'System (filehelper)', 'uid': 'filehelper'} 2017-11-09 10:29:01,453: plugins.eh_telegram_master.TelegramChannel [DEBUG] 1510223341.451574, process_msg_step_2 2017-11-09 10:29:08,007: plugins.eh_telegram_master.TelegramChannel [ERROR] NetworkError()Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen chunked=chunked) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 390, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/usr/lib/python3.5/http/client.py", line 936, in _send_output self.send(message_body) File "/usr/lib/python3.5/http/client.py", line 908, in send self.sock.sendall(data) File "/usr/lib/python3.5/ssl.py", line 899, in sendall v = self.send(data[count:]) File "/usr/lib/python3.5/ssl.py", line 869, in send return self._sslobj.write(data) File "/usr/lib/python3.5/ssl.py", line 594, in write return self._sslobj.write(data) socket.timeout: The write operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 190, in _request_wrapper resp = self._con_pool.request(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request **urlopen_kw) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body return self.urlopen(method, url, **extra_kw) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen response = conn.urlopen(method, u.request_uri, **kw) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 685, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen chunked=chunked) File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 390, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/lib/python3.5/http/client.py", line 1107, in request self._send_request(method, url, body, headers) File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request self.endheaders(body) File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders self._send_output(message_body) File "/usr/lib/python3.5/http/client.py", line 936, in _send_output self.send(message_body) File "/usr/lib/python3.5/http/client.py", line 908, in send self.sock.sendall(data) File "/usr/lib/python3.5/ssl.py", line 899, in sendall v = self.send(data[count:]) File "/usr/lib/python3.5/ssl.py", line 869, in send return self._sslobj.write(data) File "/usr/lib/python3.5/ssl.py", line 594, in write return self._sslobj.write(data) telegram.vendor.ptb_urllib3.urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out',)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/ehforwarderbot/plugins/eh_telegram_master/__init__.py", line 385, in process_msg filename=file_name) File "/usr/local/lib/python3.5/dist-packages/telegram/bot.py", line 57, in decorator result = func(self, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/telegram/bot.py", line 82, in decorator result = self._request.post(url, data, timeout=kwargs.get('timeout')) File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 264, in post 'POST', url, body=data.to_form(), headers=data.headers, **urlopen_kwargs) File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 196, in _request_wrapper raise NetworkError('urllib3 HTTPError {0}'.format(error)) telegram.error.NetworkError: urllib3 HTTPError ('Connection aborted.', timeout('The write operation timed out',)) ```

Copied from original issue: blueset/ehForwarderBot#93

blueset commented 6 years ago

Merged to #1