Support google brotli
jayvdb opened this issue · 6 comments
It would be nice if this library supported both of the brotli libraries, so the user can have either one installed.
c.f. python-hyper/brotlicffi#145 and python-hyper/brotlicffi#149
I was actually thinking about making Brotli support optional (via an extra like HTTPolice[brotli]
), because it is a very minor feature of HTTPolice but adds a hard dependency on that C library. Would that help in your case or do you actually need Brotli support?
That would not solve it, but would be very helpful.
Removing the hard dependency means supporting both is possible without requiring either.
The problem is a distro can only include one, and i suspect the google one wins, which breaks httpolice.
Commit 243b56c is the easiest solution that, I think, addresses your issue as you explained it. If I missed something, please reopen.
Nice!
Just a heads up, I found that the google brotli README.md says it only supports Python 2.7 , but I
- https://build.opensuse.org/request/show/681016 - activated tests in openSUSE's python-Brotli package, and the tests pass on Python 3.{4,6,7} so I guess that the README is not reflective of reality.
- https://build.opensuse.org/package/rdiff/home:jayvdb:coala:python3-bears/python-HTTPolice?opackage=python-HTTPolice&oproject=devel%3Alanguages%3Apython&rev=2 did a build of httpolice using google brotli and it passes tests also on py27 and py3*.
This change has now been released with HTTPolice 0.8.0.
google brotli README.md says it only supports Python 2.7
It says “2.7+”, which could also mean “all the way up to 3.x”. Anyway, they publish wheels for 3.x, so clearly they support it.
Another thing I realized is that mitmproxy-HTTPolice still pulls in brotlipy
(via mitmproxy), but hopefully this doesn’t cause much trouble, because the two distributions install distinct files and have identical API as far as both HTTPolice and mitmproxy are concerned — which is why Debian simply substitutes (Google’s) python3-brotli
for brotlipy
in their mitmproxy package.