Exemplo n.º 1
0
	def addself(self):
		connection = httplib.HTTPConnection(util.host(self.controller), util.port(controller), True, 10)
		connection.request("GET", "/add" + self.type + "?host=" + self.selfhost)
		response = connection.getresponse()
		data = response.read()
		lines = data.split("\n")
		self.handle_connect(lines)
Exemplo n.º 2
0
def request(host, path, postdata = None):
	if postdata == None:
		type = "GET"
		body = ""
	else:
		type = "POST"
		body = postdata
	connection = httplib.HTTPConnection(util.host(host), util.port(host), True, 10)
	connection.request(type, path, body)
	response = connection.getresponse()
	data = response.read()
	connection.close()
	return data