

import httplib
import urllib
import urllib2
#terminar
class Proxy:
def __init__( self , host , port , user , password ):
self.host = str( host )
self.port = port
self.user = str( user )
self.password = str( password )
class HttpMethod:
def __init__( self , host , port , path, proxy = None ):
self.host = str( host )
self.path = str( path )
self.port = port
self.proxy = proxy
self.response = ""
self.data = ""
self.headers = {}
self.headers[ "Accept" ] = "*/*"
self.headers[ "Accept-Language" ] = "en-us"
self.headers[ "Accept-Encoding" ] = "gzip, deflate"
self.headers[ "User-Agent" ] = "MSMSGS"
self.headers[ "Host" ] = "gateway.messenger.hotmail.com"
self.headers[ "Proxy-Connection" ] = "Keep-Alive"
self.headers[ "Connection" ] = "Keep-Alive"
self.headers[ "Pragma" ] = "no-cache"
self.headers[ "Content-Type" ] = "application/x-msn-messenger"
self.headers[ "Content-Length" ] = "18"
self.request = None
self.connection = httplib.HTTPConnection( self.host + ":" + str( self.port ) )
def send( self , message ):
self.headers[ "Content-Length" ] = str( len( message ) )
self.connection.request( "POST" , self.path , message , self.headers )
def recv( self ):
response = self.connection.getresponse()
self.response = response.read()
return self.response
if __name__ == "__main__":
h = HttpMethod( "gateway.messenger.hotmail.com" , 80 , "/gateway/gateway.dll?Action=open&Server=NS&IP=messenger.hotmail.com" )
h.send( "VER 1 MSNP9 CVR0\r\n" )
print h.recv()

16% are cooler, and
84% are more of a loser than you.
What does this mean?
Definitely not a loser - You're cool by us
Overall, you scored as follows:
29% scored higher (more computer geeky),
1% scored the same, and
70% scored lower (less geeky).
Compared to those in the same age group as you:
31% scored higher (more computer geeky),
1% scored the same, and
68% scored lower (less geeky).
What does this mean? Your computer geekiness is:
Mid-Level Computer Geek.
Thanks for taking the Weird Quotient test
Your score is:
82
Of all the weird test takers:
93% are more weird,
4% are just as weird, and
3% are more normal than you!
![]() | ![]() |
class ndef:
def __init__( self , method ):
if callable( method ):
self.method = method
else:
raise 'method is not callable'
def dummy( self , *args ):
pass
def when( self , condition ):
try:
if eval( condition ):
return self.method
else:
return self.dummy
except:
return self.dummy
def __call__( self , *args ):
return self.method( *args )
def ejemplo( str ):
print "Hola " + str + "!"
ejemplo = ndef( ejemplo )
ejemplo.when( "1 + 2 == 3" )( "mundo" )
ejemplo.when( "1 + 2 == 4" )( "pepe" )