summaryrefslogtreecommitdiff
path: root/dev-python/httpbin/files
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
committerroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
commitb590c8d7572b727d565cc0b8ff660d43569845de (patch)
tree06f7a4102ea4e845df8b66660f252920d52952f9 /dev-python/httpbin/files
parent24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff)
downloadbaldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip
Adding metadata
Diffstat (limited to 'dev-python/httpbin/files')
-rw-r--r--dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch b/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch
new file mode 100644
index 000000000000..b9f5cc6f8469
--- /dev/null
+++ b/dev-python/httpbin/files/httpbin-0.10.1-optional-flasgger.patch
@@ -0,0 +1,63 @@
+From 65e397d7332ab87e3b2455ff9dc99af24861b58b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 3 Feb 2024 11:20:00 +0100
+Subject: [PATCH] Support using httpbin without flasgger
+
+Make the dependency on flasgger optional. The dependency has been added
+relatively recently (i.e. before the original package was abandoned but
+after its last release), and it is only used to provide a more dynamic
+landing page. This is unnecessary for use of httpbin for testing,
+and it introduces an indirect dependency on Rust that is problematic.
+
+With this change, flasgger is no longer installed by default. It can be
+enabled via "[flasgger]" extra. When flasgger is not available, httpbin
+redirects to the "legacy" index page.
+---
+ httpbin/core.py | 17 +++++++++++++++--
+ pyproject.toml | 4 +++-
+ tests/test_httpbin.py | 4 +++-
+ 3 files changed, 21 insertions(+), 4 deletions(-)
+
+diff --git a/httpbin/core.py b/httpbin/core.py
+index a82c1b8..77576a4 100644
+--- a/httpbin/core.py
++++ b/httpbin/core.py
+@@ -33,7 +33,10 @@ try:
+ except ImportError: # werkzeug < 2.1
+ from werkzeug.wrappers import BaseResponse as Response
+
+-from flasgger import Swagger, NO_SANITIZER
++try:
++ from flasgger import Swagger, NO_SANITIZER
++except ImportError:
++ Swagger = None
+
+ from . import filters
+ from .helpers import (
+@@ -165,7 +168,8 @@ swagger_config = {
+ "specs_route": "/",
+ }
+
+-swagger = Swagger(app, sanitizer=NO_SANITIZER, template=template, config=swagger_config)
++if Swagger is not None:
++ swagger = Swagger(app, sanitizer=NO_SANITIZER, template=template, config=swagger_config)
+
+ # Set up Bugsnag exception tracking, if desired. To use Bugsnag, install the
+ # Bugsnag Python client with the command "pip install bugsnag", and set the
+@@ -244,6 +250,13 @@ def set_cors_headers(response):
+ # ------
+
+
++if Swagger is None:
++ @app.route("/")
++ def no_flasgger_index():
++ """Redirect to legacy index if flasgger is not available."""
++ return view_landing_page()
++
++
+ @app.route("/legacy")
+ def view_landing_page():
+ """Generates Landing Page in legacy layout."""
+--
+2.43.0
+