{"action":"created","issue":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/3965","repository_url":"https://api.github.com/repos/kennethreitz/requests","labels_url":"https://api.github.com/repos/kennethreitz/requests/issues/3965/labels{/name}","comments_url":"https://api.github.com/repos/kennethreitz/requests/issues/3965/comments","events_url":"https://api.github.com/repos/kennethreitz/requests/issues/3965/events","html_url":"https://github.com/kennethreitz/requests/issues/3965","id":221865041,"number":3965,"title":"OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')","user":{"login":"ShepherdTsai","id":17933013,"avatar_url":"https://avatars2.githubusercontent.com/u/17933013?v=3","gravatar_id":"","url":"https://api.github.com/users/ShepherdTsai","html_url":"https://github.com/ShepherdTsai","followers_url":"https://api.github.com/users/ShepherdTsai/followers","following_url":"https://api.github.com/users/ShepherdTsai/following{/other_user}","gists_url":"https://api.github.com/users/ShepherdTsai/gists{/gist_id}","starred_url":"https://api.github.com/users/ShepherdTsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShepherdTsai/subscriptions","organizations_url":"https://api.github.com/users/ShepherdTsai/orgs","repos_url":"https://api.github.com/users/ShepherdTsai/repos","events_url":"https://api.github.com/users/ShepherdTsai/events{/privacy}","received_events_url":"https://api.github.com/users/ShepherdTsai/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-04-14T18:35:36Z","updated_at":"2017-04-15T04:34:14Z","closed_at":"2017-04-14T18:56:30Z","body":"I'm on Windows 10 with OpenSSL 1.0.1l 15 Jan 2015, python 3.4.3, Requests 2.13.10, and when attempting to connect to a website with the following code:\r\n```\r\nimport requests\r\ns = requests.Session()\r\nres = s.get('https://ma.mohw.gov.tw/masearch/SearchBAS-101-1.aspx', verify=True)\r\n```\r\n\r\nIt throws the following error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\contrib\\pyopenssl.py\", line 436, in wrap_socket\r\n    cnx.do_handshake()\r\n  File \"C:\\Python34\\lib\\site-packages\\OpenSSL\\SSL.py\", line 1426, in do_handshake\r\n    self._raise_ssl_error(self._ssl, result)\r\n  File \"C:\\Python34\\lib\\site-packages\\OpenSSL\\SSL.py\", line 1167, in _raise_ssl_error\r\n    raise SysCallError(-1, \"Unexpected EOF\")\r\nOpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\connectionpool.py\", line 600, in urlopen\r\n    chunked=chunked)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\connectionpool.py\", line 345, in _make_request\r\n    self._validate_conn(conn)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\connectionpool.py\", line 844, in _validate_conn\r\n    conn.connect()\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\connection.py\", line 326, in connect\r\n    ssl_context=context)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\util\\ssl_.py\", line 324, in ssl_wrap_socket\r\n    return context.wrap_socket(sock, server_hostname=server_hostname)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\contrib\\pyopenssl.py\", line 443, in wrap_socket\r\n    raise ssl.SSLError('bad handshake: %r' % e)\r\nssl.SSLError: (\"bad handshake: SysCallError(-1, 'Unexpected EOF')\",)\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\adapters.py\", line 423, in send\r\n    timeout=timeout\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\packages\\urllib3\\connectionpool.py\", line 630, in urlopen\r\n    raise SSLError(e)\r\nrequests.packages.urllib3.exceptions.SSLError: (\"bad handshake: SysCallError(-1, 'Unexpected EOF')\",)\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:/Users/XXX/Desktop/MOHWcrawler/demo2.py\", line 14, in <module>\r\n    res = s.get('https://ma.mohw.gov.tw/masearch/SearchBAS-101-1.aspx', verify=True)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\sessions.py\", line 501, in get\r\n    return self.request('GET', url, **kwargs)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\sessions.py\", line 488, in request\r\n    resp = self.send(prep, **send_kwargs)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\sessions.py\", line 609, in send\r\n    r = adapter.send(request, **kwargs)\r\n  File \"C:\\Python34\\lib\\site-packages\\requests\\adapters.py\", line 497, in send\r\n    raise SSLError(e, request=request)\r\nrequests.exceptions.SSLError: (\"bad handshake: SysCallError(-1, 'Unexpected EOF')\",)\r\n```\r\n\r\nI have tried the following method:\r\n```\r\nimport requests\r\n# import ssl\r\ns = requests.Session()\r\n# s.mount('https://', SSLAdapter(ssl.PROTOCOL_TLSv1_2))\r\nres = s.get('https://ma.mohw.gov.tw/masearch/SearchBAS-101-1.aspx', verify=True)\r\n```\r\nand already installed pyasn1 and ndg-httpsclient, but doesn't work\r\n\r\nbut if I use urllib package, then I can connect to the server\r\n```\r\nfrom urllib.request import urlopen\r\nres = urlopen('https://ma.mohw.gov.tw/masearch/SearchBAS-101-1.aspx')\r\n```\r\n\r\nbut I want to use requests package to do further work,\r\nIs there any way I can solve this problem?\r\nthanks."},"comment":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/comments/294271693","html_url":"https://github.com/kennethreitz/requests/issues/3965#issuecomment-294271693","issue_url":"https://api.github.com/repos/kennethreitz/requests/issues/3965","id":294271693,"user":{"login":"ShepherdTsai","id":17933013,"avatar_url":"https://avatars2.githubusercontent.com/u/17933013?v=3","gravatar_id":"","url":"https://api.github.com/users/ShepherdTsai","html_url":"https://github.com/ShepherdTsai","followers_url":"https://api.github.com/users/ShepherdTsai/followers","following_url":"https://api.github.com/users/ShepherdTsai/following{/other_user}","gists_url":"https://api.github.com/users/ShepherdTsai/gists{/gist_id}","starred_url":"https://api.github.com/users/ShepherdTsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShepherdTsai/subscriptions","organizations_url":"https://api.github.com/users/ShepherdTsai/orgs","repos_url":"https://api.github.com/users/ShepherdTsai/repos","events_url":"https://api.github.com/users/ShepherdTsai/events{/privacy}","received_events_url":"https://api.github.com/users/ShepherdTsai/received_events","type":"User","site_admin":false},"created_at":"2017-04-15T04:34:14Z","updated_at":"2017-04-15T04:34:14Z","body":"Tried, but got the same error"}}
{"actor":{"display_login":"ShepherdTsai"}}