Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hardwareprofile: remove external dependency on simplejson
This uses the requests module and converts requests responses to json using requests' own `.json()` method on responses. For incomprehensible reasons, requests has spent about a decade using either simplejson or the standard library's json module more or less at will, and returning either one or the other exception types. They don't know why they use simplejson, we don't know why they use simplejson. In requests 3 (which will be released in the Year Of The Linux Desktop or when pigs fly, whichever one comes later) simplejson is dropped entirely. There are innumerable issues discussing the problem on the requests bugtracker, with the general consensus being that it's better to randomly return either one of two different libraries and two different library return types in errors -- because it was historically done that way and people might be depending on it. ?????? Bugs: psf/requests#710 psf/requests#2516 psf/requests#3052 psf/requests#4169 psf/requests#4842 psf/requests#5794 psf/requests#6084 The awkward workaround is to guarantee that requests' silent behavior of using simplejson *if it is installed* is forcibly triggered by forcibly depending on simplejson, and then catching the simplejson exception. The better solution here is pretty simple: do not rely on the requests module's automatic json conversion, this is as simple as using the already-imported json module and calling json.loads() on the retrieved content. Fixes: 1df343e Reimplements: bb154a8
- Loading branch information