From c9bb2c0cdf3f996eb3990922bcfc6240a539228786f0d3a6222e57ead62eeab1 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 28 Jan 2025 01:24:30 +0000 Subject: [PATCH] - Add patch remove-six.patch: * Remove use of six. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-httpbin?expand=0&rev=32 --- .gitattributes | 23 +++++++++ .gitignore | 1 + flask3.patch | 109 +++++++++++++++++++++++++++++++++++++++ httpbin-0.10.1.tar.gz | 3 ++ httpbin-0.10.2.tar.gz | 3 ++ python-httpbin.changes | 114 +++++++++++++++++++++++++++++++++++++++++ python-httpbin.spec | 84 ++++++++++++++++++++++++++++++ remove-six.patch | 57 +++++++++++++++++++++ 8 files changed, 394 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 flask3.patch create mode 100644 httpbin-0.10.1.tar.gz create mode 100644 httpbin-0.10.2.tar.gz create mode 100644 python-httpbin.changes create mode 100644 python-httpbin.spec create mode 100644 remove-six.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/flask3.patch b/flask3.patch new file mode 100644 index 0000000..24ab8c8 --- /dev/null +++ b/flask3.patch @@ -0,0 +1,109 @@ +From c1d9e33049263fed3cb27806a97f094acc350905 Mon Sep 17 00:00:00 2001 +From: Nate Prewitt +Date: Thu, 12 Oct 2023 08:30:42 -0700 +Subject: [PATCH] Support Flask 3.0 (#29) + +--- + httpbin/core.py | 8 +++----- + httpbin/helpers.py | 21 ++++++++++++++++----- + pyproject.toml | 3 +-- + 3 files changed, 20 insertions(+), 12 deletions(-) + +diff --git a/httpbin/core.py b/httpbin/core.py +index 5c1783a1..a82c1b88 100644 +--- a/httpbin/core.py ++++ b/httpbin/core.py +@@ -32,7 +32,7 @@ + from werkzeug.wrappers import Response + except ImportError: # werkzeug < 2.1 + from werkzeug.wrappers import BaseResponse as Response +-from werkzeug.http import parse_authorization_header ++ + from flasgger import Swagger, NO_SANITIZER + + from . import filters +@@ -47,6 +47,7 @@ + H, + ROBOT_TXT, + ANGRY_ASCII, ++ parse_authorization_header, + parse_multi_value_header, + next_stale_after_value, + digest_challenge_response, +@@ -636,16 +637,13 @@ def redirect_to(): + args_dict = request.args.items() + args = CaseInsensitiveDict(args_dict) + +- # We need to build the response manually and convert to UTF-8 to prevent +- # werkzeug from "fixing" the URL. This endpoint should set the Location +- # header to the exact string supplied. + response = app.make_response("") + response.status_code = 302 + if "status_code" in args: + status_code = int(args["status_code"]) + if status_code >= 300 and status_code < 400: + response.status_code = status_code +- response.headers["Location"] = args["url"].encode("utf-8") ++ response.headers["Location"] = args["url"] + + return response + +diff --git a/httpbin/helpers.py b/httpbin/helpers.py +index b29e1835..836c8026 100644 +--- a/httpbin/helpers.py ++++ b/httpbin/helpers.py +@@ -13,8 +13,14 @@ + import time + import os + from hashlib import md5, sha256, sha512 +-from werkzeug.http import parse_authorization_header + from werkzeug.datastructures import WWWAuthenticate ++from werkzeug.http import dump_header ++ ++try: ++ from werkzeug.http import parse_authorization_header ++except ImportError: # werkzeug < 2.3 ++ from werkzeug.datastructures import Authorization ++ parse_authorization_header = Authorization.from_header + + from flask import request, make_response + from six.moves.urllib.parse import urlparse, urlunparse +@@ -466,9 +472,14 @@ def digest_challenge_response(app, qop, algorithm, stale = False): + ]), algorithm) + opaque = H(os.urandom(10), algorithm) + +- auth = WWWAuthenticate("digest") +- auth.set_digest('me@kennethreitz.com', nonce, opaque=opaque, +- qop=('auth', 'auth-int') if qop is None else (qop,), algorithm=algorithm) +- auth.stale = stale ++ values = { ++ 'realm': 'me@kennethreitz.com', ++ 'nonce': nonce, ++ 'opaque': opaque, ++ 'qop': dump_header(('auth', 'auth-int') if qop is None else (qop,)), ++ 'algorithm': algorithm, ++ 'stale': stale, ++ } ++ auth = WWWAuthenticate("digest", values=values) + response.headers['WWW-Authenticate'] = auth.to_header() + return response +diff --git a/pyproject.toml b/pyproject.toml +index 020457ec..9454e569 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -31,14 +31,13 @@ classifiers = [ + "Programming Language :: Python :: 3.12", + ] + dependencies = [ +- "Flask", ++ "flask >= 2.2.4", + "brotlicffi", + "decorator", + "flasgger", + 'greenlet < 3.0; python_version<"3.12"', + 'greenlet >= 3.0.0a1; python_version>="3.12.0rc0"', + 'importlib-metadata; python_version<"3.8"', +- "werkzeug >= 0.14.1", + "six", + ] + diff --git a/httpbin-0.10.1.tar.gz b/httpbin-0.10.1.tar.gz new file mode 100644 index 0000000..74844d4 --- /dev/null +++ b/httpbin-0.10.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b8596beb0e75a7b653c39d1f3cf263d6d5c476d29e1df6f7bb2b70bf9f06a3d +size 107058 diff --git a/httpbin-0.10.2.tar.gz b/httpbin-0.10.2.tar.gz new file mode 100644 index 0000000..a030199 --- /dev/null +++ b/httpbin-0.10.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:632148698261c8684ea2d2b624cdea845b402b1fe91736e89df886408c6317a9 +size 107327 diff --git a/python-httpbin.changes b/python-httpbin.changes new file mode 100644 index 0000000..655ad47 --- /dev/null +++ b/python-httpbin.changes @@ -0,0 +1,114 @@ +------------------------------------------------------------------- +Tue Jan 28 01:22:41 UTC 2025 - Steve Kowalik + +- Add patch remove-six.patch: + * Remove use of six. + +------------------------------------------------------------------- +Tue Oct 1 14:35:38 UTC 2024 - John Paul Adrian Glaubitz + +- Update to 0.10.2 + * Added support for Flask 3.0 +- Drop flask3.patch, merged upstream +- Update Requires from setup.py + +------------------------------------------------------------------- +Tue Oct 24 13:30:26 UTC 2023 - Markéta Machová + +- Use Brotli instead of dropped brotlicffi + +------------------------------------------------------------------- +Thu Oct 19 08:11:44 UTC 2023 - Markéta Machová + +- Repackage, new active upstream + * In their words: We were unable to get ahold of the folks at postmanlabs to + maintain the original project, and httpbin is used for other packages + within the python ecosystem, such as pytest-httpbin which is in turn used + by packages such as requests so we have forked this package. That means + that httpbin.org is not actually backed by this repo, but the httpbin + package is. Confusing right? + * Drop now unneeded _service, changes in the *spec +- Update to 0.10.1 + * Override docker image port with HTTPBIN_PORT + * A number of fixes for code rot, thanks @mgorny and @tjni +- Drop upstreamed/no-longer-needed patches: + * fix-setup-py.patch + * httpbin-pr674-wekzeug2.1.patch + * werkzeug.patch + * support-werkzeug-2.3.patch +- Add flask3.patch to support Flask 3.0 + +------------------------------------------------------------------- +Wed Jun 21 08:35:31 UTC 2023 - Steve Kowalik + +- Add patch support-werkzeug-2.3.patch, support Werkzeug 2.3. + (bsc#1212557) +- Remove now unneeded blinker from {Build,}Requires. + +------------------------------------------------------------------- +Fri Apr 21 12:26:18 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Thu Apr 13 22:41:52 UTC 2023 - Matej Cepl + +- Make calling of %{sle15modernpython} optional. + +------------------------------------------------------------------- +Fri Apr 22 19:17:15 UTC 2022 - Ben Greiner + +- add httpbin-pr674-wekzeug2.1.patch for Werkzeug 2.1 compatibility + gh#postmanlabs/httpbin#674 + +------------------------------------------------------------------- +Tue Apr 12 20:36:37 UTC 2022 - Ben Greiner + +- Truncate werkzeug.patch as Flask changed their behavior back to + returning relative URLs. +- Update fix-setup-py.patch accordingly +- Update _service file (rerun modifies the archive, but keeps same + tag) + +------------------------------------------------------------------- +Tue Mar 15 04:57:06 UTC 2022 - Steve Kowalik + +- Use of raven has been removed, drop it from {Build,}Requires. +- Add patch fix-setup-py.patch: + * Drop raven and fix brotli in setup.py + +------------------------------------------------------------------- +Wed Jun 23 08:30:27 UTC 2021 - Steve Kowalik + +- Modify werkzeug.patch to support Werkzeug 2.0, update Requires. + +------------------------------------------------------------------- +Tue May 28 11:12:45 UTC 2019 - Tomáš Chvátal + +- Add patch to fix new werkzeug build, atm PR upstream: + * werkzeug.patch + +------------------------------------------------------------------- +Thu Mar 14 11:53:37 UTC 2019 - tchvatal@suse.com + +- Switch to service, upstream is now at release 0.9.2 but nobody + bothers with tags, keep the last tagged/pypi release as a version + and add all other stuff as git commit +- Update to version 0.7.0+git20181107.f8ec666: + * Corrected repository URL in app.json. + * remove duplicated "X-Forwarded-For" from ENV_HEADERS + * Added Python 3.7 to Travis/Tox. + * Removed httpbin.org link which is mentioned 3 times in README + +------------------------------------------------------------------- +Tue Mar 12 15:50:39 UTC 2019 - Tomáš Chvátal + +- Update to 0.7.0: + * no upstream changelog +- Enable tests +- Add missing dependencies + +------------------------------------------------------------------- +Tue Apr 4 17:56:34 UTC 2017 - jmatejek@suse.com + +- initial commit as test requirement for python-requests diff --git a/python-httpbin.spec b/python-httpbin.spec new file mode 100644 index 0000000..e050e35 --- /dev/null +++ b/python-httpbin.spec @@ -0,0 +1,84 @@ +# +# spec file for package python-httpbin +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define modname httpbin +%{?sle15_python_module_pythons} +Name: python-httpbin +Version: 0.10.2 +Release: 0 +Summary: HTTP Request and Response Service +License: MIT +URL: https://github.com/psf/httpbin +Source: https://files.pythonhosted.org/packages/source/h/%{modname}/%{modname}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#psf/httpbin#40 +Patch0: remove-six.patch +BuildRequires: %{python_module Brotli} +BuildRequires: %{python_module Flask >= 2.2.4} +BuildRequires: %{python_module Werkzeug >= 2.0} +BuildRequires: %{python_module decorator} +BuildRequires: %{python_module flasgger} +BuildRequires: %{python_module gevent} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-Brotli +Requires: python-Flask >= 2.2.4 +Requires: python-Werkzeug >= 2.2.2 +Requires: python-decorator +Requires: python-flasgger +Requires: python-gevent +BuildArch: noarch +%python_subpackages + +%description +httpbin(1): HTTP Request & Response Service + +Testing an HTTP Library can become difficult sometimes. +RequestBin is fantastic for testing POST requests, but doesn't let +you control the response. This exists to cover +all kinds of HTTP scenarios. Additional endpoints are being considered. + +All endpoint responses are JSON-encoded. + +%prep +%autosetup -p1 -n %{modname}-%{version} +# we are running CPython, let us use Brotli instead of brotlicffi (they should be compatible) +sed -i 's/brotlicffi/brotli/' httpbin/filters.py + +%build +export LANG=en_US.UTF-8 +%pyproject_wheel + +%install +export LANG=en_US.UTF-8 +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%doc README.md +%license LICENSE +%{python_sitelib}/httpbin +%{python_sitelib}/httpbin-%{version}.dist-info + +%changelog diff --git a/remove-six.patch b/remove-six.patch new file mode 100644 index 0000000..7d4726e --- /dev/null +++ b/remove-six.patch @@ -0,0 +1,57 @@ +From 17d02f215e18df999facc20808f47fcbb72f3a18 Mon Sep 17 00:00:00 2001 +From: Alexandre Detiste +Date: Fri, 5 Jan 2024 15:21:04 +0100 +Subject: [PATCH] cleanup remaining usage of "six" + +--- + httpbin/filters.py | 2 +- + httpbin/helpers.py | 3 ++- + pyproject.toml | 1 - + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/httpbin/filters.py b/httpbin/filters.py +index 4deeaaad..a656279e 100644 +--- a/httpbin/filters.py ++++ b/httpbin/filters.py +@@ -12,7 +12,7 @@ + + import brotlicffi as _brotli + +-from six import BytesIO ++from io import BytesIO + from decimal import Decimal + from time import time as now + +diff --git a/httpbin/helpers.py b/httpbin/helpers.py +index 836c8026..cdf045c0 100644 +--- a/httpbin/helpers.py ++++ b/httpbin/helpers.py +@@ -13,6 +13,8 @@ + import time + import os + from hashlib import md5, sha256, sha512 ++from urllib.parse import urlparse, urlunparse ++ + from werkzeug.datastructures import WWWAuthenticate + from werkzeug.http import dump_header + +@@ -23,7 +25,6 @@ + parse_authorization_header = Authorization.from_header + + from flask import request, make_response +-from six.moves.urllib.parse import urlparse, urlunparse + + + from .structures import CaseInsensitiveDict +diff --git a/pyproject.toml b/pyproject.toml +index c5bdb811..b82f7b6f 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -38,7 +38,6 @@ dependencies = [ + 'greenlet < 3.0; python_version<"3.12"', + 'greenlet >= 3.0.0a1; python_version>="3.12.0rc0"', + 'importlib-metadata; python_version<"3.8"', +- "six", + "werkzeug >= 2.2.2", + ] +