Repository navigation
4.1.0
See Migration
for what to check when upgrading.
Changed
parseandparse_jsonnow raiseInvalidResponsefor an empty response
batch. They used to return an empty iterator and silently accept the invalid
reply.- If a response has both
resultanderror, anderroris not null,
parsenow returns anError. It used to returnOk(result=None)and drop
the server's error. JSON-RPC 2.0 doesn't allow both, but JSON-RPC 1.0 style
servers send"result": nullwith an error. - If a response has a
resultand a non-nullerrorthat isn't an object
withcodeandmessage(for example a string,falseor""),parse
now raisesInvalidResponse. 4.0 returnedOkand ignored the error. parse_jsonon JSON that isn't an object or array, such as"pong", used to
say "Use parse_json on strings". It now says it expected an object.parsegiven bytes now raises the same "Use parse_json on strings" error as
a str.notificationsends tuple params as a list, the same asrequestdoes.
The JSON output is unchanged, but the returned dict now holds a list.
Added
- Malformed responses now raise
InvalidResponsewith a message that says what
is wrong, for examplemissing 'id'. It subclassesKeyErrorand
TypeError, which earlier versions raised, so existingexceptclauses
still catch it.
Documentation
- The
parsedocstring now says that a batch gives a one-pass lazy iterator,
not a list. - New pages: an API reference generated from the docstrings, a migration
guide, and one page per transport. New guides cover notifications, batches,
ids, error handling, typing and threads.