def sendRequest(host, port, path, headers, params, reqType="GET"): params = urllib.urlencode(params) path = path + "?" + params if reqType == "GET" else path WADebug.stdDebug(reqType) WADebug.stdDebug(headers) WADebug.stdDebug(params) WADebug.stdDebug("Opening connection to %s" % host) conn = httplib.HTTPSConnection(host, port) WADebug.stdDebug("Requesting %s" % path) conn.request(reqType, path, params, headers) response = conn.getresponse().read() #WADebug.stdDebug(response) return response
def sendRequest(host, port, path, headers, params, reqType="GET"): params = urlencode(params); path = path + "?"+ params if reqType == "GET" and params else path WADebug.stdDebug(reqType) WADebug.stdDebug(headers); WADebug.stdDebug(params); WADebug.stdDebug("Opening connection to %s" % host); conn = httplib.HTTPSConnection(host ,port) if port == 443 else httplib.HTTPConnection(host ,port) WADebug.stdDebug("Requesting %s" % path) conn.request(reqType, path, params, headers); response = conn.getresponse() #WADebug.stdDebug(response) return response
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): WADebug.stdDebug(headers) if len(params): WADebug.stdDebug(params) WADebug.stdDebug("Opening connection to %s" % host) conn = httplib.HTTPSConnection( host, port) if port == 443 else httplib.HTTPConnection(host, port) WADebug.stdDebug("Sending %s request to %s" % (reqType, path)) conn.request(reqType, path, params, headers) response = conn.getresponse() return response
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): WADebug.stdDebug(headers) if len(params): WADebug.stdDebug(params) WADebug.stdDebug("Opening connection to %s" % host); conn = WARequest.getConn(host, port) if conn is None: conn = WARequest.getConn(host, port, True) WADebug.stdDebug("Sending %s request to %s" % (reqType, path)) conn.request(reqType, path, params, headers); response = conn.getresponse() return response