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:
urlencode(query, doseq=0)
Encode a sequence of two-element tuples or dictionary into a URL query string.
Are you looking for urllib.quote(callback)
?