Reading key/value pairs from text file, line by line, and passing values/dict to urlopen http function
<p>I have to fill in multiple form fields on a web page<br>
I got the http POST part completed so I can post data to the web page.<br>
I also got the part completed where I create a dictionary of key/value pairs and have the form fields filled on the web page.</p>

<p>Key/value pairs:</p>

<pre><code>input1 = {'hostname' : 'host', 'port' : '22', 'basedn' : 'CN=Users', 'bindusername' : 'admin', 'bindpassword' : 'passwd', 'groupname' : 'CN=Group,CN=Users,DC=tech,DC=com', 'usernameattribute' : 'name'}

for line in open("/Users/rwettstein/Scripts/Files/ldap-settings.txt", "r"):
    print line
    input = line
    time.sleep(10)

    params = urllib.urlencode(dict(input))

try:
    f_handler = urlopen('https://hostname/path/file.php', params)
    except urllib2.HTTPError, error:
        print "Error Code: %s" % error.code
</code></pre>

<p>However, if I place the key/value pair information into a text file and then read the data from the text file, read from the file line by line, encode it into a dictionary, and then hand it off to the Http Request, I get the following error:</p>

<pre><code>ValueError: dictionary update sequence element #0 has length 1; 2 is required
</code></pre>

<p>Is this error occurring because the value being passed from the file read function only returns one single argument?</p>
