{"action":"opened","issue":{"url":"https://api.github.com/repos/leandrotoledo/python-telegram-bot/issues/108","labels_url":"https://api.github.com/repos/leandrotoledo/python-telegram-bot/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/leandrotoledo/python-telegram-bot/issues/108/comments","events_url":"https://api.github.com/repos/leandrotoledo/python-telegram-bot/issues/108/events","html_url":"https://github.com/leandrotoledo/python-telegram-bot/issues/108","id":118669071,"number":108,"title":"lots of urllib and ssl exceptions","user":{"login":"mjnaderi","id":2115303,"avatar_url":"https://avatars.githubusercontent.com/u/2115303?v=3","gravatar_id":"","url":"https://api.github.com/users/mjnaderi","html_url":"https://github.com/mjnaderi","followers_url":"https://api.github.com/users/mjnaderi/followers","following_url":"https://api.github.com/users/mjnaderi/following{/other_user}","gists_url":"https://api.github.com/users/mjnaderi/gists{/gist_id}","starred_url":"https://api.github.com/users/mjnaderi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjnaderi/subscriptions","organizations_url":"https://api.github.com/users/mjnaderi/orgs","repos_url":"https://api.github.com/users/mjnaderi/repos","events_url":"https://api.github.com/users/mjnaderi/events{/privacy}","received_events_url":"https://api.github.com/users/mjnaderi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-24T18:00:14Z","updated_at":"2015-11-24T18:00:14Z","closed_at":null,"body":"When I run the code, some times I get some exceptions (different exceptions at different times), and some times it works correctly. I am using version `2.9.2`.\r\n\r\nSome of exceptions:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"------.py\", line 66, in <module>\r\n    main()\r\n  File \"------.py\", line 14, in main\r\n    LAST_UPDATE_ID = bot.getUpdates()[-1].update_id  # Get lastest update\r\n  File \"/home/aaa/mybot/venv/lib/python2.7/site-packages/telegram/bot.py\", line 126, in decorator\r\n    result = func(self, *args, **kwargs)\r\n  File \"/home/aaa/mybot/venv/lib/python2.7/site-packages/telegram/bot.py\", line 689, in getUpdates\r\n    result = request.post(url, data, network_delay=network_delay)\r\n  File \"/home/aaa/mybot/venv/lib/python2.7/site-packages/telegram/utils/request.py\", line 106, in post\r\n    result = urlopen(request, timeout=timeout).read()\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 154, in urlopen\r\n    return opener.open(url, data, timeout)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 431, in open\r\n    response = self._open(req, data)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 449, in _open\r\n    '_open', req)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 409, in _call_chain\r\n    result = func(*args)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 1240, in https_open\r\n    context=self._context)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 1194, in do_open\r\n    h.request(req.get_method(), req.get_selector(), req.data, headers)\r\n  File \"/usr/lib64/python2.7/httplib.py\", line 1053, in request\r\n    self._send_request(method, url, body, headers)\r\n  File \"/usr/lib64/python2.7/httplib.py\", line 1093, in _send_request\r\n    self.endheaders(body)\r\n  File \"/usr/lib64/python2.7/httplib.py\", line 1049, in endheaders\r\n    self._send_output(message_body)\r\n  File \"/usr/lib64/python2.7/httplib.py\", line 893, in _send_output\r\n    self.send(msg)\r\n  File \"/usr/lib64/python2.7/httplib.py\", line 855, in send\r\n    self.connect()\r\n  File \"/usr/lib64/python2.7/httplib.py\", line 1274, in connect\r\n    server_hostname=server_hostname)\r\n  File \"/usr/lib64/python2.7/ssl.py\", line 352, in wrap_socket\r\n    _context=self)\r\n  File \"/usr/lib64/python2.7/ssl.py\", line 579, in __init__\r\n    self.do_handshake()\r\n  File \"/usr/lib64/python2.7/ssl.py\", line 816, in do_handshake\r\n    match_hostname(self.getpeercert(), self.server_hostname)\r\n  File \"/usr/lib64/python2.7/ssl.py\", line 271, in match_hostname\r\n    % (hostname, ', '.join(map(repr, dnsnames))))\r\nssl.CertificateError: hostname 'api.telegram.org' doesn't match either of 'urlp.asm.skype.com', 'urlp-asm-skype.trafficmanager.net', 'ea1-urlp.cloudapp.net', 'eus1-urlp.asm.skype.com', 'eus1-urlp.cloudapp.net', 'neu1-urlp.asm.skype.com', 'neu1-urlp.cloudapp.net', 'nus1-urlp.asm.skype.com', 'nus1-urlp.cloudapp.net', 'sa1-urlp.asm.skype.com', 'sa1-urlp.cloudapp.net', 'sus1-urlp.asm.skype.com', 'sus1-urlp.cloudapp.net', 'weu1-urlp.asm.skype.com', 'weu1-urlp.cloudapp.net', 'wus1-urlp.asm.skype.com', 'wus1-urlp.cloudapp.net'\r\n```\r\n\r\nI opened https://openshift.redhat.com in my browser. Then after running python code, last line of previous exception changed to:\r\n\r\n```\r\nssl.CertificateError: hostname 'api.telegram.org' doesn't match either of 'openshift.com', 'enterprise.openshift.com', 'www.openshift.com', 'repo.fusesource.com', 'assets.openshift.net', 'download.jboss.org', 'www.jboss.org', 'static.jboss.org', 'downloads.jboss.org', 'developer.redhat.com', 'developers.redhat.com', 'it-developers.redhat.com', 'openshift.redhat.com'\r\n```\r\n\r\nThen I moved to another computer, in a different country, and following exceptions raised randomly (sometimes it worked, but one of these exception raised after some minutes):\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"-------.py\", line 66, in <module>\r\n    main()\r\n  File \"-------.py\", line 16, in main\r\n    for update in bot.getUpdates(offset=LAST_UPDATE_ID):\r\n  File \"/home/aaa/mybot/venv/local/lib/python2.7/site-packages/telegram/bot.py\", line 126, in decorator\r\n    result = func(self, *args, **kwargs)\r\n  File \"/home/aaa/mybot/venv/local/lib/python2.7/site-packages/telegram/bot.py\", line 689, in getUpdates\r\n    result = request.post(url, data, network_delay=network_delay)\r\n  File \"/home/aaa/mybot/venv/local/lib/python2.7/site-packages/telegram/utils/request.py\", line 106, in post\r\n    result = urlopen(request, timeout=timeout).read()\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 127, in urlopen\r\n    return _opener.open(url, data, timeout)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 404, in open\r\n    response = self._open(req, data)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 422, in _open\r\n    '_open', req)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 382, in _call_chain\r\n    result = func(*args)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 1222, in https_open\r\n    return self.do_open(httplib.HTTPSConnection, req)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 1184, in do_open\r\n    raise URLError(err)\r\nurllib2.URLError: <urlopen error [Errno -5] No address associated with hostname>\r\n```\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"------.py\", line 66, in <module>\r\n    main()\r\n  File \"------.py\", line 16, in main\r\n    for update in bot.getUpdates(offset=LAST_UPDATE_ID):\r\n  File \"/home/aaa/mybot/venv/local/lib/python2.7/site-packages/telegram/bot.py\", line 126, in decorator\r\n    result = func(self, *args, **kwargs)\r\n  File \"/home/aaa/mybot/venv/local/lib/python2.7/site-packages/telegram/bot.py\", line 689, in getUpdates\r\n    result = request.post(url, data, network_delay=network_delay)\r\n  File \"/home/aaa/mybot/venv/local/lib/python2.7/site-packages/telegram/utils/request.py\", line 106, in post\r\n    result = urlopen(request, timeout=timeout).read()\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 127, in urlopen\r\n    return _opener.open(url, data, timeout)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 404, in open\r\n    response = self._open(req, data)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 422, in _open\r\n    '_open', req)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 382, in _call_chain\r\n    result = func(*args)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 1222, in https_open\r\n    return self.do_open(httplib.HTTPSConnection, req)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 1184, in do_open\r\n    raise URLError(err)\r\nurllib2.URLError: <urlopen error [Errno -2] Name or service not known>\r\n```\r\n\r\nAnother exception which raised after code was running successfully for a while:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"------.py\", line 66, in <module>\r\n    main()\r\n  File \"------.py\", line 16, in main\r\n    for update in bot.getUpdates(offset=LAST_UPDATE_ID):\r\n  File \"/home/aaa/mybot/venv/lib/python2.7/site-packages/telegram/bot.py\", line 126, in decorator\r\n    result = func(self, *args, **kwargs)\r\n  File \"/home/aaa/mybot/venv/lib/python2.7/site-packages/telegram/bot.py\", line 689, in getUpdates\r\n    result = request.post(url, data, network_delay=network_delay)\r\n  File \"/home/aaa/mybot/venv/lib/python2.7/site-packages/telegram/utils/request.py\", line 106, in post\r\n    result = urlopen(request, timeout=timeout).read()\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 154, in urlopen\r\n    return opener.open(url, data, timeout)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 431, in open\r\n    response = self._open(req, data)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 449, in _open\r\n    '_open', req)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 409, in _call_chain\r\n    result = func(*args)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 1240, in https_open\r\n    context=self._context)\r\n  File \"/usr/lib64/python2.7/urllib2.py\", line 1197, in do_open\r\n    raise URLError(err)\r\nurllib2.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:590)>\r\n```"}}