home *** CD-ROM | disk | FTP | other *** search
/ Freelog 33 / Freelog033.iso / Progr / Python-2.2.1.exe / TEST_SOCKET_SSL.PY < prev    next >
Encoding:
Text File  |  2001-10-18  |  704 b   |  28 lines

  1. # Test just the SSL support in the socket module, in a moderately bogus way.
  2.  
  3. import test_support
  4.  
  5. # Optionally test SSL support.  This currently requires the 'network' resource
  6. # as given on the regrtest command line.  If not available, nothing after this
  7. # line will be executed.
  8. test_support.requires('network')
  9.  
  10. import socket
  11. if not hasattr(socket, "ssl"):
  12.     raise test_support.TestSkipped("socket module has no ssl support")
  13.  
  14. import urllib
  15.  
  16. socket.RAND_status()
  17. try:
  18.     socket.RAND_egd(1)
  19. except TypeError:
  20.     pass
  21. else:
  22.     print "didn't raise TypeError"
  23. socket.RAND_add("this is a random string", 75.0)
  24.  
  25. f = urllib.urlopen('https://sf.net')
  26. buf = f.read()
  27. f.close()
  28.