Why am I getting this error when trying to urlencode this string
>>> callback = "http://localhost/application/authtwitter?twitterCallback"
>>> urllib.urlencode(callback)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib.py", line 1261, in urlencode
raise TypeError
TypeError: not a valid non-string sequence or mapping object
That’s not what that function does:
Are you looking for?
urllib.quote(callback)Python 2urllib.parse.quote(callback)Python 3