Why not have a json method like in requests? That way detail will stay as is and and json() will return if there is json data, or else return either None or raise an exception