CSC111 getDirectoryInfo.py

From CSclasswiki
Jump to: navigation, search

--Thiebaut 20:11, 20 April 2009 (UTC)


# getDirectoryInfo.py
# D. Thiebaut
# This simple demo uses the getUrlInfo class we have created in the module
# getUrlInfo.py, and shows how to get the email address of a person from 
# the Smith directory.

import getUrlInfo
import sys

def main():

    urlGrabber = getUrlInfo.getUrlInfo()
    urlGrabber.setUrl( "http://www.smith.edu/global_campusdirectory.php?name=%s" )
    urlGrabber.setMarkers( "<a href=\"mailto:", "?" )
    name = raw_input( "What name? " )
    email = urlGrabber.getInfo( name )
    print "email address for %s = %s" % ( name, email )


main()