HTTP Stuff

This command serves the files relative to the current directory.

python -m SimpleHTTPServer 8000

Python3

from urllib import request

response = request.urlopen('https://apple.com')

theRequest = request.Request('http://localhost:8080/')

theRequest.add_header(

'User-agent',

'MyAgent',

)

response = request.urlopen(theRequest)

from urllib2 import urlopen

url = 'http://...' u = urlopen(url, 'r') for row in u: print row