warequest.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:whatsapp-rest-webservice 作者: svub 项目源码 文件源码
def sendRequest(host, port, path, headers, params, reqType="GET"):

        params = urlencode(params)


        path = path + "?"+ params if reqType == "GET" and params else path

        if len(headers):
            logger.debug(headers)
        if len(params):
            logger.debug(params)

        logger.debug("Opening connection to %s" % host);
        conn = httplib.HTTPSConnection(host ,port) if port == 443 else httplib.HTTPConnection(host ,port)

        logger.debug("Sending %s request to %s" % (reqType, path))
        conn.request(reqType, path, params, headers);

        response = conn.getresponse()
        return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号