import httplib class N3Http: # defines the address to be accessed # example www.w3.org def putAddress(self, s): self.address = s # the string s contains the page at the mentionned address # example /index/html def getRequest(self, s): h = httplib.HTTP(self.address) h.putrequest('GET', s) h.putheader('Accept', 'text/html') h.putheader('Accept', 'text/plain') h.putheader('Host', self.address) h.endheaders() errcode, errmsg, headers = h.getreply() print errcode # Should be 200 f = h.getfile() self.data = f.read() # Get the raw HTML f.close() http = N3Http() http.putAddress("192.32.2.7") http.getRequest("/index.html") print (http.data)