New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ujson option #1595
Comments
You absolutely can. The easiest way to do it is to monkeypatch: import requests
import ujson
requests.models.json = ujson That should cause all further calls to |
So by looking at |
Certainly it will be safe to override that behaviour. For obvious reasons we won't change this in the core library, but I highly encourage you to use |
Fair :) Thank you @Lukasa ! |
My pleasure, I hope you enjoy using Requests! =D Let us know if you have any problems. ⭐ |
@Lukasa - would you consider using ujson by default if it is installed? Something like:
|
Nope. =) I see no reason for Requests to favour ujson over any other third-party JSON decoder. We do nothing very complicated with JSON decoding, so replacing the decoder we use either via monkeypatching or via doing the decoding yourself is totally safe. With that in mind, there's no good reason to move away from the standard library in Requests proper. |
For those finding this issue circa-2019, please not that I believe the current way of doing this would instead be: import requests
import ujson
requests.models.complexjson = ujson I've seen plenty of examples of code on Github that monkey-patches |
Hi,
Is it possible to use ujson as an optional JSON encoder/decoder for requests? Or, if ujson satisfies all the use cases of requests, replace simplejson with ujson?
The text was updated successfully, but these errors were encountered: