{"action":"created","issue":{"url":"https://api.github.com/repos/tgalal/yowsup/issues/706","labels_url":"https://api.github.com/repos/tgalal/yowsup/issues/706/labels{/name}","comments_url":"https://api.github.com/repos/tgalal/yowsup/issues/706/comments","events_url":"https://api.github.com/repos/tgalal/yowsup/issues/706/events","html_url":"https://github.com/tgalal/yowsup/issues/706","id":67242577,"number":706,"title":"SSL CERTIFICATE_VERIFY_FAILED (Windows - Python 3.4)","user":{"login":"fasfelipe","id":3688158,"avatar_url":"https://avatars.githubusercontent.com/u/3688158?v=3","gravatar_id":"","url":"https://api.github.com/users/fasfelipe","html_url":"https://github.com/fasfelipe","followers_url":"https://api.github.com/users/fasfelipe/followers","following_url":"https://api.github.com/users/fasfelipe/following{/other_user}","gists_url":"https://api.github.com/users/fasfelipe/gists{/gist_id}","starred_url":"https://api.github.com/users/fasfelipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasfelipe/subscriptions","organizations_url":"https://api.github.com/users/fasfelipe/orgs","repos_url":"https://api.github.com/users/fasfelipe/repos","events_url":"https://api.github.com/users/fasfelipe/events{/privacy}","received_events_url":"https://api.github.com/users/fasfelipe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-08T23:28:37Z","updated_at":"2015-04-15T18:03:36Z","closed_at":null,"body":"Hi folks,\r\n\r\nI'm having SSL problem on **\"Registration\"** and **\"Register\"** using yowsup-cli. I'm using windows with Python 3.4 and last week it was working fine, and I could register the number without any problem.\r\nI seek for this SSL problem and found this problem on linux with a older version of python, but without a good solution. Any one know what should be this problem and what could I do to solve it? Any hint what cause this problem?\r\n\r\nHe is the call I am using.\r\n```\r\npython yowsup-cli registration --requestcode sms --phone 5511XXXXXXXXX --cc 55 --mcc 724 --mnc 13\r\n ```\r\n\r\nThrow this out:\r\n```\r\nTraceback (most recent call last):\r\n  File \"yowsup-cli\", line 304, in <module>\r\n    if not parser.process():\r\n  File \"yowsup-cli\", line 158, in process\r\n    self.handleRegister(self.args[\"register\"], config)\r\n  File \"yowsup-cli\", line 181, in handleRegister\r\n    result = req.send()\r\n  File \"C:\\Users\\Felipe\\Documents\\Python\\WhatsApp\\yowsup-master\\yowsup\\common\\http\\warequest.py\", line 67, in send\r\n    return self.sendGetRequest(parser)\r\n  File \"C:\\Users\\Felipe\\Documents\\Python\\WhatsApp\\yowsup-master\\yowsup\\common\\http\\warequest.py\", line 105, in sendGetRequest\r\n    self.response = WARequest.sendRequest(host, port, path, headers, params, \"GET\")\r\n  File \"C:\\Users\\Felipe\\Documents\\Python\\WhatsApp\\yowsup-master\\yowsup\\common\\http\\warequest.py\", line 161, in sendRequest\r\n    conn.request(reqType, path, params, headers);\r\n  File \"C:\\Python34\\lib\\http\\client.py\", line 1088, in request\r\n    self._send_request(method, url, body, headers)\r\n  File \"C:\\Python34\\lib\\http\\client.py\", line 1126, in _send_request\r\n    self.endheaders(body)\r\n  File \"C:\\Python34\\lib\\http\\client.py\", line 1084, in endheaders\r\n    self._send_output(message_body)\r\n  File \"C:\\Python34\\lib\\http\\client.py\", line 922, in _send_output\r\n    self.send(msg)\r\n  File \"C:\\Python34\\lib\\http\\client.py\", line 857, in send\r\n    self.connect()\r\n  File \"C:\\Python34\\lib\\http\\client.py\", line 1231, in connect\r\n    server_hostname=server_hostname)\r\n  File \"C:\\Python34\\lib\\ssl.py\", line 365, in wrap_socket\r\n    _context=self)\r\n  File \"C:\\Python34\\lib\\ssl.py\", line 583, in __init__\r\n    self.do_handshake()\r\n  File \"C:\\Python34\\lib\\ssl.py\", line 810, in do_handshake\r\n    self._sslobj.do_handshake()\r\nssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)\r\n```\r\n\r\nThanks all.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/10745866-ssl-certificate_verify_failed-windows-python-3-4?utm_campaign=plugin&utm_content=tracker%2F298781&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F298781&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/tgalal/yowsup/issues/comments/93506167","html_url":"https://github.com/tgalal/yowsup/issues/706#issuecomment-93506167","issue_url":"https://api.github.com/repos/tgalal/yowsup/issues/706","id":93506167,"user":{"login":"Codehimn","id":2944054,"avatar_url":"https://avatars.githubusercontent.com/u/2944054?v=3","gravatar_id":"","url":"https://api.github.com/users/Codehimn","html_url":"https://github.com/Codehimn","followers_url":"https://api.github.com/users/Codehimn/followers","following_url":"https://api.github.com/users/Codehimn/following{/other_user}","gists_url":"https://api.github.com/users/Codehimn/gists{/gist_id}","starred_url":"https://api.github.com/users/Codehimn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Codehimn/subscriptions","organizations_url":"https://api.github.com/users/Codehimn/orgs","repos_url":"https://api.github.com/users/Codehimn/repos","events_url":"https://api.github.com/users/Codehimn/events{/privacy}","received_events_url":"https://api.github.com/users/Codehimn/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T18:03:36Z","updated_at":"2015-04-15T18:03:36Z","body":"FIxed:\r\nChange warequest.py to =\r\n\r\nimport urllib,  sys, os, logging\r\nimport ssl, socket\r\nimport hashlib\r\nfrom .waresponseparser import ResponseParser\r\nfrom yowsup.env import S40YowsupEnv\r\nCURRENT_ENV = S40YowsupEnv()\r\n\r\nif sys.version_info < (3, 0):\r\n    import httplib\r\n    from urllib import urlencode\r\nelse:\r\n    from http import client as httplib\r\n    from urllib.parse import urlencode\r\n\r\nlogger = logging.getLogger(__name__)\r\n\r\n\r\nclass WARequest(object):\r\n\r\n    OK = 200\r\n\r\n    def __init__(self):\r\n\r\n        self.pvars = []\r\n        self.port = 443\r\n        self.type = \"GET\"\r\n        self.parser = None\r\n        self.params = []\r\n        self.headers = {}\r\n\r\n        self.sent = False\r\n        self.response = None\r\n\r\n\r\n\r\n    def setParsableVariables(self, pvars):\r\n        self.pvars = pvars\r\n\r\n    def onResponse(self, name, value):\r\n        if name == \"status\":\r\n            self.status = value\r\n        elif name == \"result\":\r\n            self.result = value\r\n\r\n    def addParam(self,name,value):\r\n        self.params.append((name,value))\r\n\r\n    def removeParam(self, name):\r\n        for i in range(0, len(self.params)):\r\n            if self.params[i][0] == name:\r\n                del self.params[i]\r\n\r\n\r\n    def addHeaderField(self, name, value):\r\n        self.headers[name] = value\r\n\r\n    def clearParams(self):\r\n        self.params = []\r\n\r\n    def getUserAgent(self):\r\n        return CURRENT_ENV.getUserAgent()\r\n\r\n    def send(self, parser = None):\r\n\r\n        if self.type == \"POST\":\r\n            return self.sendPostRequest(parser)\r\n\r\n        return self.sendGetRequest(parser)\r\n\r\n    def setParser(self, parser):\r\n        if isinstance(parser, ResponseParser):\r\n            self.parser = parser\r\n        else:\r\n            logger.error(\"Invalid parser\")\r\n\r\n    def getConnectionParameters(self):\r\n\r\n        if not self.url:\r\n            return \"\", \"\", self.port\r\n\r\n        try:\r\n            url = self.url.split(\"://\", 1)\r\n            url = url[0] if len(url) == 1 else url[1]\r\n\r\n            host, path = url.split('/', 1)\r\n        except ValueError:\r\n            host = url\r\n            path = \"\"\r\n\r\n        path = \"/\" + path\r\n\r\n        return host, self.port, path\r\n\r\n    def sendGetRequest(self, parser = None):\r\n        self.response = None\r\n        params =  self.params#[param.items()[0] for param in self.params];\r\n\r\n        parser = parser or self.parser or ResponseParser()\r\n\r\n        headers = dict(list({\"User-Agent\":self.getUserAgent(),\r\n                \"Accept\": parser.getMeta()\r\n            }.items()) + list(self.headers.items()));\r\n\r\n        host,port,path = self.getConnectionParameters()\r\n\r\n        self.response = WARequest.sendRequest(host, port, path, headers, params, \"GET\")\r\n\r\n        if not self.response.status == WARequest.OK:\r\n            logger.error(\"Request not success, status was %s\"%self.response.status)\r\n            return {}\r\n\r\n        data = self.response.read()\r\n        logger.info(data)\r\n\r\n        self.sent = True\r\n        return parser.parse(data.decode(), self.pvars)\r\n\r\n    def sendPostRequest(self, parser = None):\r\n        self.response = None\r\n        params =  self.params #[param.items()[0] for param in self.params];\r\n\r\n        parser = parser or self.parser or ResponseParser()\r\n\r\n        headers = dict(list({\"User-Agent\":self.getUserAgent(),\r\n                \"Accept\": parser.getMeta(),\r\n                \"Content-Type\":\"application/x-www-form-urlencoded\"\r\n            }.items()) + list(self.headers.items()))\r\n\r\n        host,port,path = self.getConnectionParameters()\r\n        self.response = WARequest.sendRequest(host, port, path, headers, params, \"POST\")\r\n\r\n\r\n        if not self.response.status == WARequest.OK:\r\n            logger.error(\"Request not success, status was %s\" % self.response.status)\r\n            return {}\r\n\r\n        data = self.response.read()\r\n\r\n        logger.info(data)\r\n\r\n        self.sent = True\r\n        return parser.parse(data.decode(), self.pvars)\r\n\r\n\r\n    @staticmethod\r\n    def sendRequest(host, port, path, headers, params, reqType=\"GET\"):\r\n\r\n        params = urlencode(params)\r\n\r\n\r\n        path = path + \"?\"+ params if reqType == \"GET\" and params else path\r\n\r\n        if len(headers):\r\n            logger.debug(headers)\r\n        if len(params):\r\n            logger.debug(params)\r\n\r\n        logger.debug(\"Opening connection to %s\" % host);\r\n        conn = httplib.HTTPSConnection(host ,port) if port == 443 else httplib.HTTPConnection(host ,port)\r\n\r\n        logger.debug(\"Sending %s request to %s\" % (reqType, path))\r\n\r\n\r\n        sock = socket.create_connection((conn.host, conn.port), conn.timeout, conn.source_address)\r\n        conn.sock = ssl.wrap_socket(sock, conn.key_file, conn.cert_file, ssl_version=ssl.PROTOCOL_TLSv1)\r\n\r\n        conn.request(reqType, path, params, headers);\r\n\r\n        response = conn.getresponse()\r\n        return response\r\n"}}