Skip to content

Commit 7ab2459

Browse files
committed
Use brotli with CPython, brotlicffi elsewhere
1 parent 1f6e049 commit 7ab2459

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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
@@ -31,7 +31,8 @@ classifiers = [
3131
"Programming Language :: Python :: 3.12",
3232
]
3333
dependencies = [
34-
"brotlicffi",
34+
"brotli; platform_python_implementation == 'CPython'",
35+
"brotlicffi; platform_python_implementation != 'CPython'",
3536
"decorator",
3637
"flasgger",
3738
"flask >= 2.2.4",

0 commit comments

Comments
 (0)