Advertisement
rfmonk

urllib_urlencode.py

Feb 10th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import urllib
  5.  
  6. query_args = {'q': 'query string', 'foo': 'bar'}
  7. encoded_args = urllib.urlencode(query_args)
  8. print 'Encoded:', encoded_args
  9.  
  10. url = 'http://localhost:8080/?' + encoded_args
  11. print urllib.urlopen(url).read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement