0

I want to make a connection to http://mysite.org using GET method keeping connection alive and sending an user-agent header to the server. I know I should use urlgrabber or smth like that but I need the actual code actually. Please help me friends.. THANK YOU

conn = httplib.HTTPConnection(urlparse(url)[1])
conn.request("GET", urlparse(url)[2])
conn.putheader("Referer", referer)
conn.endheaders()
r1 = conn.getresponse()

whats wrong with that??

joaquin
  • 78,380
  • 27
  • 136
  • 151

2 Answers2

0

Have you read this and this? One of them will take you here and this is probably your answer.

Community
  • 1
  • 1
Michael Litvin
  • 3,662
  • 1
  • 29
  • 38
-2

Use httplib

The Python docs page has examples there. http://docs.python.org/library/httplib.html

jontsai
  • 662
  • 1
  • 6
  • 13