Issue 25439: Add type checks to urllib.request.Request ...
bugs.python.org › issue25439Oct 20, 2015 · TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str. That didn't work, I also needed to encode the output of urlencode(). Most of these problems could be prevented if Request() raised for non-str URLs, and non-bytes (and non-None) POST data. Unless there some valid reason to accept invalid types, I think they ...