{"action":"opened","issue":{"url":"https://api.github.com/repos/nickoala/telepot/issues/242","repository_url":"https://api.github.com/repos/nickoala/telepot","labels_url":"https://api.github.com/repos/nickoala/telepot/issues/242/labels{/name}","comments_url":"https://api.github.com/repos/nickoala/telepot/issues/242/comments","events_url":"https://api.github.com/repos/nickoala/telepot/issues/242/events","html_url":"https://github.com/nickoala/telepot/issues/242","id":232908178,"number":242,"title":"Connection reset by peer (again)","user":{"login":"beta48","id":20609566,"avatar_url":"https://avatars2.githubusercontent.com/u/20609566?v=3","gravatar_id":"","url":"https://api.github.com/users/beta48","html_url":"https://github.com/beta48","followers_url":"https://api.github.com/users/beta48/followers","following_url":"https://api.github.com/users/beta48/following{/other_user}","gists_url":"https://api.github.com/users/beta48/gists{/gist_id}","starred_url":"https://api.github.com/users/beta48/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beta48/subscriptions","organizations_url":"https://api.github.com/users/beta48/orgs","repos_url":"https://api.github.com/users/beta48/repos","events_url":"https://api.github.com/users/beta48/events{/privacy}","received_events_url":"https://api.github.com/users/beta48/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-01T14:58:23Z","updated_at":"2017-06-01T14:58:23Z","closed_at":null,"body":"Hello,\r\nTelepot is great, it is working perfectly (over longtime) with version 7.1 and python 2.7.\r\n\r\nAfter installing version 12.0 I get from time to time an error message when trying to send a textmessage. When catching this error (and logging it), a later attempt after some seconds to send another message works perfectly. It seems to me to be [this problem](https://github.com/nickoala/telepot/issues/87) with urllib again discussed for version 8 but obviously not fixed in version 12. The problem seems to appear after an idle time (no messages sent) of some hours.\r\n\r\nWhat can I do?\r\n\r\nError log:\r\n\r\n`ERROR | Textnachricht an beta konnte nicht gesendet werden.\r\nTraceback (most recent call last):\r\n  File \"/home/pi/Projekte/HomePi/telegram.py\", line 483, in telegram_text\r\n    bot.sendMessage(shared.telegram_users_authentified[i][1], message, reply_markup=show_individual_keyboard)\r\n  File \"/usr/local/lib/python2.7/dist-packages/telepot/__init__.py\", line 445, in sendMessage\r\n    return self._api_request('sendMessage', _rectify(p))\r\n  File \"/usr/local/lib/python2.7/dist-packages/telepot/__init__.py\", line 434, in _api_request\r\n    return api.request((self._token, method, params, files), **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/telepot/api.py\", line 130, in request\r\n    r = fn(*args, **kwargs)  # `fn` must be thread-safe\r\n  File \"/usr/local/lib/python2.7/dist-packages/urllib3/request.py\", line 148, in request_encode_body\r\n    return self.urlopen(method, url, **extra_kw)\r\n  File \"/usr/local/lib/python2.7/dist-packages/urllib3/poolmanager.py\", line 321, in urlopen\r\n    response = conn.urlopen(method, u.request_uri, **kw)\r\n  File \"/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py\", line 649, in urlopen\r\n    _stacktrace=sys.exc_info()[2])\r\n  File \"/usr/local/lib/python2.7/dist-packages/urllib3/util/retry.py\", line 357, in increment\r\n    raise six.reraise(type(error), error, _stacktrace)\r\n  File \"/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py\", line 600, in urlopen\r\n    chunked=chunked)\r\n  File \"/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py\", line 379, in _make_request\r\n    httplib_response = conn.getresponse(buffering=True)\r\n  File \"/usr/lib/python2.7/httplib.py\", line 1073, in getresponse\r\n    response.begin()\r\n  File \"/usr/lib/python2.7/httplib.py\", line 415, in begin\r\n    version, status, reason = self._read_status()\r\n  File \"/usr/lib/python2.7/httplib.py\", line 371, in _read_status\r\n    line = self.fp.readline(_MAXLINE + 1)\r\n  File \"/usr/lib/python2.7/socket.py\", line 476, in readline\r\n    data = self._sock.recv(self._rbufsize)\r\n  File \"/usr/lib/python2.7/ssl.py\", line 714, in recv\r\n    return self.read(buflen)\r\n  File \"/usr/lib/python2.7/ssl.py\", line 608, in read\r\n    v = self._sslobj.read(len or 1024)\r\nProtocolError: ('Connection aborted.', error(104, 'Connection reset by peer'))`\r\n\r\nSimplified python function used to send the messages.\r\n\r\n`# Text per Telegram senden\t\r\ndef telegram_text(message,anwen_ID):\r\n\tglobal bot\r\n\t\r\n\t# Custom Keyboard\r\n\tshow_individual_keyboard = {'keyboard': [['/scharf', '/teilscharf'],['/unscharf', '/status']], 'resize_keyboard': True}\r\n\t\r\n\ttry:\r\n\t\tbot.sendMessage(str(anwen_ID), message, reply_markup=show_individual_keyboard)\r\n\t\tlog.info(\"Textnachricht an ID \" + str(anwen_ID) + \" geschickt\")\r\n\texcept:\r\n\t\tlog.exception(\"Textnachricht an ID \" + str(anwen_ID) + \" konnte nicht gesendet werden.\")`"}}
{"actor":{"display_login":"beta48"}}