I want to convert following statement from urllib to urllib2 equivalent statement
params = urllib.parse.urlencode( {'status': msg} )
I can import only urllib2 and urlparse.
urllib2 is not really the "2nd version" of urllib. It's not possible to "translate" all functionality from urllib to urllib2.
Even the documentation for urllib2 states that you should use urllib for URL encoding.
Extracted from the urllib2.urlopen documentation:
...data should be a buffer in the standard application/x-www-form-urlencoded format. The
urllib.urlencode()function takes a mapping or sequence of 2-tuples and returns a string in this format.
urllib2is not really the "2nd version" ofurllib. It's not possible to "translate" all functionality fromurllibtourllib2