kennethreitz/requests — pull request #2238 by buttscicles (2014-09-20 20:47:05+00:00)
Title: Call to_native_string on urls passed to prepare_url

Hi there folks.

Currently `prepare_url` will call `unicode` or `str` on the url arg depending on the python version. This works fine for most cases, but the one case it trips up on is bytestrings on python 3.x as the string representation of these is `"b'http://httpbin.org'"`. Eventually this will surface as an `InvalidSchema` exception.

I find this to be completely unexpected, and I'd imagine it's not something that's been done intentionally.

Technically this a breaking change. The possibility of passing non-strings to `prepare_url` is undocumented and untested, but regardless it may be better to go about fixing this in a different way, that's your call.