1
> On Jan 6, 2017, at 3:36 PM, Tristan Seligmann <[email protected]> wrote:
>
> On Fri, 6 Jan 2017 at 21:21 steven meiers <[email protected]
> <mailto:[email protected]>> wrote:
> glyph (without seeing the the code or backtrace) suggested that:
> "I think the issue might be that it doesn't support bytes() on py3,
> it's registered against str() or something"
>
> Actually, the problem is the reverse of this; only bytes is supported, but
> you're passing str (unicode) in.
Aah, thanks for pointing this out.
> somepage = yield treq.post(target_url, json.dumps({hmac: key,
> "username": username, 'pw':'', 'gender':'m', 'aaaa':''}),
>
> json.dumps returns str (ie. unicode) on py3; throwing in a .encode('utf-8')
> here is probably what you want.
Maybe we should support unicode for the body as well. We can set the charset
in the mime-type and everything so that it will be properly intelligible by the
server, which doesn't happen if the user manually encodes like this.
Even if we do this though - is there any way to convince json.dumps to behave
consistently between 2/3 for the purposes of examples?
-glyph
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python