Return to Snippet

Revision: 18740
at October 6, 2009 21:08 by PalmdalePython


Initial Code
#!/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()

Initial URL


Initial Description
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 <module>
    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.

Initial Title
Python, urlencode attributes

Initial Tags


Initial Language
Python