HTTP
Server Side
#!/usr/bin/python

from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler

class GetHandler(BaseHTTPRequestHandler):

    def do_GET(self):
        print 'Path: ', self.path
        print 'Client Address: ', self.client_address
        print 'Command: ', self.command
        print 'Request Version: ', self.request_version
        #print 'Responses: ', self.responses
        self.send_response(200)
        self.end_headers()
        self.wfile.write('Received request ...')
        return

def run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler):
    server_address = ('', 8080)
    httpd = server_class(server_address, GetHandler)
    httpd.serve_forever()

if __name__ == '__main__':
    run();
			
curl -i http://localhost:8080/?foo=barHTTP/1.0
			
Client Side
#open local file or webpage online
#!/usr/bin/python

import urllib

#Open local file
response = urllib.urlopen('U.py')

#print response.read() # read whole file
print response.readline() # read a single line
print response.readlines() # read all lines
print response.fileno();
print response.info()
print response.getcode()
print response.geturl()
			
XML
#server.py
#!/usr/bin/python

import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer

def is_even(n):
    return n % 2 == 0

def display(filename):
    with open(filename) as f:
        lines = f.readlines();
    return lines

server = SimpleXMLRPCServer(("localhost", 8000))

server.register_function(is_even, "is_even")
server.register_function(display, "display");

server.serve_forever()
			
#client.py
#!/usr/bin/python

import xmlrpclib

proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
print "3 is even: %s" % str(proxy.is_even(3))
print "100 is even: %s" % str(proxy.is_even(100))

print proxy.display('server.py')
			
Reference