Skip to content

Commit d141f6e

Browse files
committed
Use brotli with CPython, brotlicffi elsewhere
1 parent c1d9e33 commit d141f6e

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

httpbin/filters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
import gzip as gzip2
1111
import zlib
1212

13-
import brotlicffi as _brotli
13+
try:
14+
import brotlicffi as _brotli
15+
except ImportError:
16+
import brotli as _brotli
1417

1518
from six import BytesIO
1619
from decimal import Decimal

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ classifiers = [
3232
]
3333
dependencies = [
3434
"flask >= 2.2.4",
35-
"brotlicffi",
35+
"brotli; platform_python_implementation == 'CPython'",
36+
"brotlicffi; platform_python_implementation != 'CPython'",
3637
"decorator",
3738
"flasgger",
3839
'greenlet < 3.0; python_version<"3.12"',

0 commit comments

Comments
 (0)