[code.view]

[top] / python / PyMOTW / urllib2 / urllib2_urlopen_post.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """
     """
     #end_pymotw_header
     
     import urllib
     import urllib2
     
     query_args = { 'q':'query string', 'foo':'bar' }
     encoded_args = urllib.urlencode(query_args)
     url = 'http://localhost:8080/'
     print urllib2.urlopen(url, encoded_args).read()
     

[top] / python / PyMOTW / urllib2 / urllib2_urlopen_post.py

contact | logmethods.com