/ Published in: Python
                    
                                        
Hello, 
I am just new to Python, I have failed to resolve this Windows (Python Idle). The doc's point to this format, but I continually get the following error:
urlencode missing attribute
Traceback (most recent call last):
File "C:\Documents and Settings\My Documents\Python-dir\TEST-P1.py", line 15, in
data = headers + urllib.urlencode(body)
AttributeError: 'module' object has no attribute 'urlencode'
Checked for modules with the same name and Cygwin does not generate this error.
                I am just new to Python, I have failed to resolve this Windows (Python Idle). The doc's point to this format, but I continually get the following error:
urlencode missing attribute
Traceback (most recent call last):
File "C:\Documents and Settings\My Documents\Python-dir\TEST-P1.py", line 15, in
data = headers + urllib.urlencode(body)
AttributeError: 'module' object has no attribute 'urlencode'
Checked for modules with the same name and Cygwin does not generate this error.
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
#!/usr/bin/python
import urllib
url = 'https://xxx.xxx.com/yyyyyy/yyy'
headers = {'USERID:user\@ccc.com','PASSWORD:dfdfdf','parm1:nnnn','parm2:hhh'}
body = {'eemail=gggg.hhh\@gmail.com,parm3=build\(0\)'}
data = headers + urllib.urlencode(body)
request = urllib.Request(url, data)
response = urllib.urlopen(req)
the_page = response.read()
Comments
 Subscribe to comments
                    Subscribe to comments
                
                