How to Encode Parameters into an HTML Parsing Script

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jun 22 00:45:44 EDT 2007


En Thu, 21 Jun 2007 23:37:07 -0300, <SMERSH009X at gmail.com> escribió:

> So for example if I wanted to navigate to an encoded url
> http://online.investools.com/landing.iedu?signedin=true rather than
> just http://online.investools.com/landing.iedu   How would I do this?
> How can I modify the script to urlencode these parameters:
> {signedin:true}     and to associate them with a specific url from the
> urlList

If you want to use GET, append '?' plus the encoded parameters to the  
desired url:

py> data = {'signedin':'true', 'another':42}
py> print urlencode(data)
signedin=true&another=42

Do not use the data argument to urlopen.

-- 
Gabriel Genellina




More information about the Python-list mailing list