Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postmanlabs/httpbin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: psf/httpbin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Jul 10, 2023

  1. Copy the full SHA
    63bf254 View commit details
  2. Copy the full SHA
    41becbd View commit details
  3. Copy the full SHA
    1cb9204 View commit details

Commits on Jul 11, 2023

  1. Merge pull request #1 from psf/ci

    Setup CI through GHA
    nateprewitt authored Jul 11, 2023
    Copy the full SHA
    0ad858b View commit details
  2. Copy the full SHA
    2a8e66c View commit details
  3. Copy the full SHA
    8f8eb3b View commit details
  4. Copy the full SHA
    1b0fd2c View commit details

Commits on Jul 12, 2023

  1. Copy the full SHA
    ab48ba2 View commit details

Commits on Jul 20, 2023

  1. Use CMD instead of ENTRYPOINT

    exhuma committed Jul 20, 2023
    Copy the full SHA
    67705ab View commit details

Commits on Aug 1, 2023

  1. Fix tox.ini to actually run the test suite

    Fix the tox.ini commands to use the correct test suite path, and run
    it via unittest since executing the file does not do anything.
    mgorny committed Aug 1, 2023
    Copy the full SHA
    2ed10ab View commit details
  2. Relax the dependency bounds to newest compatible versions

    Relax the dependency bounds in `setup.py` to permit the newest versions
    that are compatible with the current httpbin code, that is permit
    the test suite to pass.
    mgorny committed Aug 1, 2023
    Copy the full SHA
    f67bf70 View commit details
  3. Fix test compatibility with werkzeug 0.15.x

    Remove the check for `Content-Length` header that is not provided
    by default anymore with werkzeug 0.15.x.
    
    See: pallets/werkzeug#2347
    
    Taken from #684
    mgorny committed Aug 1, 2023
    Copy the full SHA
    f6041d7 View commit details
  4. Enable testing on Python up to 3.12

    Since the newer dependency versions and the code itself are now
    compatible with newer Python versions, we can test the package up
    to 3.12.  Add pypy3 to the test matrix while at it.
    mgorny committed Aug 1, 2023
    Copy the full SHA
    cefb0c4 View commit details
  5. Fix compatibility with werkzeug 2.1.x

    Update the code for werkzeug 2.1.x where `BaseResponse` class was
    replaced by `Response`.
    
    See: pallets/werkzeug#2276
    
    Taken from #684
    mgorny committed Aug 1, 2023
    Copy the full SHA
    496d0b9 View commit details
  6. Fix test_base64 not to pass bytes to .get()

    Fix passing bytes instead of str as the URL to .get() function.  This
    fixes one of the test failures with werkzeug 2.3.x.
    mgorny committed Aug 1, 2023
    Copy the full SHA
    f00338f View commit details
  7. Remove the obsolete dep on raven

    Remove the dependency on raven, as the code using it has been removed
    in e543380.
    mgorny committed Aug 1, 2023
    Copy the full SHA
    47b73ca View commit details
  8. Replace brotlipy with brotlicffi

    The brotlipy package has been renamed to brotlicffi.  Update the imports
    and dependencies accordingly.  The major advanage of the new package
    is that it no longer collides with the Python bindings provided
    by brotli itself.
    mgorny committed Aug 1, 2023
    Copy the full SHA
    592d403 View commit details
  9. Fix test failures with werkzeug 2.3.x

    Fix digest tests to check for `stale=True` case-insensitively, in order
    to maintain compatibility with werkzeug < 2.3 (that used `stale=TRUE`)
    and >= 2.3 (that uses `stale=True`).
    mgorny committed Aug 1, 2023
    Copy the full SHA
    5d08073 View commit details

Commits on Aug 10, 2023

  1. Merge pull request #4 from exhuma/issue-2-customisable-port

    Issue 2 customisable port
    kevin1024 authored Aug 10, 2023
    Copy the full SHA
    74cd1d0 View commit details
  2. Update README.md

    kevin1024 authored Aug 10, 2023
    Copy the full SHA
    468ff1f View commit details
  3. Merge pull request #6 from mgorny/combined-fixes

    Assorted fixes for code rot
    kevin1024 authored Aug 10, 2023
    Copy the full SHA
    8a9a5ee View commit details
  4. Copy the full SHA
    c1adc3d View commit details
  5. Update README.md

    kevin1024 authored Aug 10, 2023
    Copy the full SHA
    63a268a View commit details
  6. Update VERSION

    kevin1024 authored Aug 10, 2023
    Copy the full SHA
    c62ab87 View commit details

Commits on Aug 11, 2023

  1. Exclude tests from installed packages

    Fix `setup.py` not to include `tests` in installed packages.  Otherwise
    they end up being installed as a top-level package, i.e.:
    
        /usr/lib/python*/site-packages/tests
    mgorny committed Aug 11, 2023
    Copy the full SHA
    2907ee1 View commit details
  2. Add a minimal pyproject.toml

    Add a minimal `pyproject.toml` that explicitly specifies `setuptools`
    as the build backend, and effectively switches from the legacy backend
    to the modern backend.
    mgorny committed Aug 11, 2023
    Copy the full SHA
    fa1c40d View commit details
  3. Remove unused dependency on gevent

    Remove the dependency on `gevent` as it is not used within the installed
    package.  It is only used by `httpbin.bash`, and that file is not
    installed.
    mgorny committed Aug 11, 2023
    Copy the full SHA
    16d877b View commit details
  4. Fix docker build & run

    exhuma committed Aug 11, 2023
    Copy the full SHA
    f175add View commit details

Commits on Aug 13, 2023

  1. Enable pip caching for GitHub Actions

    Enable pip caching in order to avoid repeatedly rebuilding all
    the PyPy wheels for source packages.  This is inspired by discussion
    in psf/requests#6496 and it may help with
    the PyPy CI failures.
    mgorny committed Aug 13, 2023
    Copy the full SHA
    448b82b View commit details

Commits on Aug 14, 2023

  1. Merge pull request #9 from mgorny/fix-inst

    Wheel build fixes
    kevin1024 authored Aug 14, 2023
    Copy the full SHA
    e354fdd View commit details
  2. Merge pull request #14 from mgorny/pip-cache

    Enable pip caching for GitHub Actions
    kevin1024 authored Aug 14, 2023
    Copy the full SHA
    25c7bfa View commit details
  3. Merge pull request #11 from exhuma/fix-docker-build

    Fix docker build & run
    kevin1024 authored Aug 14, 2023
    Copy the full SHA
    7012f1a View commit details
  4. Update setup.py

    Update github URL to point to the fork
    kevin1024 authored Aug 14, 2023
    Copy the full SHA
    e7d491f View commit details
  5. Copy the full SHA
    7a7efc4 View commit details
  6. Remove pipenv & Pipfile

    exhuma committed Aug 14, 2023
    Copy the full SHA
    72a22b8 View commit details
  7. Copy the full SHA
    0444fe8 View commit details
  8. Add requirements.txt

    exhuma committed Aug 14, 2023
    Copy the full SHA
    8100b34 View commit details
  9. Remove Pipfile from Dockerfile

    exhuma committed Aug 14, 2023
    Copy the full SHA
    526c064 View commit details
  10. Copy the full SHA
    c835bce View commit details
  11. Update to actions/checkout v3

    exhuma committed Aug 14, 2023
    Copy the full SHA
    90d6f8b View commit details
  12. Copy the full SHA
    414ad5a View commit details
  13. Copy the full SHA
    b6240fe View commit details
  14. Install package for testing

    exhuma committed Aug 14, 2023
    Copy the full SHA
    d5023dc View commit details
  15. Copy the full SHA
    bf7970d View commit details
  16. Upgrade to actions/checkout v3

    exhuma committed Aug 14, 2023
    Copy the full SHA
    275b87f View commit details
  17. Copy the full SHA
    23f3957 View commit details
  18. Remove the job-timeout

    exhuma committed Aug 14, 2023
    Copy the full SHA
    5d7cd43 View commit details

Commits on Aug 15, 2023

  1. Switch to MIT License

    As discussed in #17
    exhuma committed Aug 15, 2023
    Copy the full SHA
    44f1b66 View commit details
  2. Remove requirements.txt & use multi-stage build

    References #17
    
    The docker-image has all dependencies "frozen" in place, so a
    requirements.txt is not really needed.
    
    It would be difficult (but possible) to ensure that the docker-image
    uses the same `requirements.txt` as the one that was published. It adds
    a considerable overhead to the build complexity and is not really
    needed. Supporting multiple end-user environments (and
    operating-systems) would also require *multiple* such files. And even
    then it is not guaranteed to work everywhere.
    
    Limiting the officially supported targets to "library" and "docker"
    removes those complexities.
    exhuma committed Aug 15, 2023
    Copy the full SHA
    59b558e View commit details
  3. Update README

    exhuma committed Aug 15, 2023
    Copy the full SHA
    a2bdcd3 View commit details
6 changes: 6 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Treat each other well

Everyone participating in the _httpbin_ project, and in particular in the issue tracker,
pull requests, and social media activity, is expected to treat other people with respect
and more generally to follow the guidelines articulated in the
[Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/).
50 changes: 50 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contribution Guidelines

Before opening any pull requests, please first open an issue describing the
proposed change. httpbin is currently considered frozen for new features and
only accepting backwards-compatible bug fixes.

To get the greatest chance of helpful responses, please also observe the
following additional notes.

## Questions

The GitHub issue tracker is for *bug reports*. Questions about usage should be
directed to [Stack Overflow](https://stackoverflow.com/).

## Good Bug Reports

Please be aware of the following things when filing bug reports:

1. Avoid raising duplicate issues. *Please* use the GitHub issue search feature
to check whether your bug report or feature request has been mentioned in
the past. Duplicate bug reports and feature requests are a huge maintenance
burden on the limited resources of the project. If it is clear from your
report that you would have struggled to find the original, that's ok, but
if searching for a selection of words in your issue title would have found
the duplicate then the issue will likely be closed extremely abruptly.
2. When filing bug reports about exceptions or tracebacks, please include the
*complete* traceback. Partial tracebacks, or just the exception text, are
not helpful. Issues that do not contain complete tracebacks may be closed
without warning.
3. Make sure you provide a suitable amount of information to work with. This
means you should provide:

- Guidance on **how to reproduce the issue**. Ideally, this should be a
*small* code sample that can be run immediately by the maintainers.
Failing that, let us know what you're doing, how often it happens, what
environment you're using, etc. Be thorough: it prevents us needing to ask
further questions.
- Tell us **what you expected to happen**. When we run your example code,
what are we expecting to happen? What does "success" look like for your
code?
- Tell us **what actually happens**. It's not helpful for you to say "it
doesn't work" or "it fails". Tell us *how* it fails: do you get an
exception? A hang? A non-200 status code? How was the actual result
different from your expected result?
- Tell us **what version of httpbin you're using**, and
**how you installed it**. Different versions of httpbin behave
differently and have different bugs.

If you do not provide all of these things, it may result in delays
with triaging your issue.
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Run CI

on: [push, pull_request]

jobs:
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.9", "pypy-3.10"]
os: [ubuntu-22.04, macOS-latest, windows-latest]
# Python 3.8 and 3.9 do not run on macOS-latest which
# is now using arm64 hardware.
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760
exclude:
- { python-version: "3.8", os: "macos-latest" }
- { python-version: "3.9", os: "macos-latest" }
include:
- { python-version: "3.8", os: "macos-13" }
- { python-version: "3.9", os: "macos-13" }

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# from https://github.com/actions/cache/blob/main/examples.md#python---pip
- name: Get pip cache dir
id: pip-cache
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
# the action does not permit updating an existing cache, so we need
# unique keys
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: Set up environment & install dependencies
run: |
python -m pip install pip-tools
pip-compile --quiet --generate-hashes --extra mainapp > requirements.txt
python -m pip install --use-pep517 --requirement requirements.txt
python -m pip install --use-pep517 .[test]
- name: Run tests
run: python -m pytest tests
- name: Store tested requirements.txt file as artifact
uses: actions/upload-artifact@v3
with:
name: requirements.txt
path: |
requirements.txt
publish-docker-image:
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: System Dependencies for Packaging
run: |
sudo apt-get update
sudo apt-get install -y python3-pip python3-venv
python3 -m venv /tmp/tomlq
/tmp/tomlq/bin/pip install --upgrade pip
/tmp/tomlq/bin/pip install yq
- name: Checkout
uses: actions/checkout@v3
- name: Set Environment
run: |
echo "APP_VERSION=$(/tmp/tomlq/bin/tomlq -r .project.version pyproject.toml)" >> $GITHUB_ENV
echo "APP_DESC=$(/tmp/tomlq/bin/tomlq -r .project.description pyproject.toml)" >> $GITHUB_ENV
- name: Retrieve tested requirements file
uses: actions/download-artifact@v3
with:
name: requirements.txt
- name: Ensure docker build is working
run: >
docker build
--build-arg "APP_VERSION=${APP_VERSION}"
--build-arg "APP_DESC=${APP_DESC}"
.
105 changes: 105 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
name: Publish
on: [push]
permissions:
contents: write
packages: write
jobs:
unit-tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set up environment & install dependencies
run: |
python -m pip install pip-tools
pip-compile --quiet --generate-hashes --extra mainapp > requirements.txt
python -m pip install --requirement requirements.txt
python -m pip install .[test]
- name: Run tests
run: tox
- name: Check file contents
run: cat requirements.txt
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/release-')
uses: softprops/action-gh-release@v1
with:
files: |
requirements.txt
Dockerfile
- name: Store tested requirements.txt file as artifact
uses: actions/upload-artifact@v3
with:
name: requirements.txt
path: |
requirements.txt
publish-docker-image:
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: System Dependencies for Packaging
run: |
sudo apt-get update
sudo apt-get install -y python3-pip python3-venv
python3 -m venv /tmp/tomlq
/tmp/tomlq/bin/pip install --upgrade pip
/tmp/tomlq/bin/pip install yq
- name: Checkout
uses: actions/checkout@v3
- name: Set Environment
run: |
echo "APP_VERSION=$(/tmp/tomlq/bin/tomlq -r .project.version pyproject.toml)" >> $GITHUB_ENV
echo "APP_DESC=$(/tmp/tomlq/bin/tomlq -r .project.description pyproject.toml)" >> $GITHUB_ENV
- name: Retrieve tested requirements file
uses: actions/download-artifact@v3
with:
name: requirements.txt
- name: Check file contents
run: cat requirements.txt
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: startsWith(github.ref, 'refs/tags/release-')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Images
if: startsWith(github.ref, 'refs/tags/release-')
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
APP_VERSION=${{ env.APP_VERSION }}
APP_DESC=${{ env.APP_DESC }}
tags: |
ghcr.io/${{ github.repository }}:${{ env.APP_VERSION }}
ghcr.io/${{ github.repository }}:latest
pypi-publish:
needs: [unit-tests]
if: startsWith(github.ref, 'refs/tags/release-')
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/httpbin
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Build distribution
run: |
python -m pip install --upgrade pip build
pyproject-build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ dist/
.eggs/
.workon
.epio-app
*.pyc
.tox
*.pyc
*.egg-info
*.swp
.vscode/
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

52 changes: 39 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,48 @@
FROM ubuntu:18.04

LABEL name="httpbin"
LABEL version="0.9.2"
LABEL description="A simple HTTP service."
LABEL org.kennethreitz.vendor="Kenneth Reitz"
FROM python:3.10-slim AS build

ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update -y && apt install python3-pip git -y && pip3 install --no-cache-dir pipenv
RUN apt-get -y update
RUN apt-get install -y \
python3-pip \
python3-venv

ADD Pipfile Pipfile.lock /httpbin/
WORKDIR /httpbin
RUN /bin/bash -c "pip3 install --no-cache-dir -r <(pipenv lock -r)"
RUN python3 -m venv /opt/httpbin
RUN /opt/httpbin/bin/pip install -U pip

ADD requirements.txt /requirements.txt
RUN /opt/httpbin/bin/pip install --no-deps --requirement /requirements.txt

ADD . /httpbin
RUN pip3 install --no-cache-dir /httpbin
RUN /opt/httpbin/bin/pip install --no-deps /httpbin


# ----------------------------------------------------------------------------

FROM python:3.10-slim AS prod

ARG APP_VERSION
LABEL name="httpbin"
LABEL version=${APP_VERSION}
LABEL description="A simple HTTP service."
LABEL org.kennethreitz.vendor="Kenneth Reitz"

RUN useradd \
--system \
--shell /bin/nologin \
--no-create-home \
--home /opt/httpbin \
httpbin

COPY --from=build /opt/httpbin /opt/httpbin
WORKDIR /opt/httpbin

EXPOSE 80
ADD httpbin.bash /opt/httpbin/bin
RUN chmod +x /opt/httpbin/bin/httpbin.bash
RUN chown --recursive httpbin /opt/httpbin
EXPOSE 8080
CMD ["/opt/httpbin/bin/httpbin.bash"]

CMD ["gunicorn", "-b", "0.0.0.0:80", "httpbin:app", "-k", "gevent"]
USER httpbin
18 changes: 3 additions & 15 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
ISC License

Copyright (c) 2017 Kenneth Reitz.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
This software is made available under the terms of *either* of the licenses
found in LICENSE.ISC or LICENSE.MIT. Contributions to httpbin are made
under the terms of *both* these licenses.
15 changes: 15 additions & 0 deletions LICENSE.ISC
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright (c) 2017 Kenneth Reitz.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 changes: 21 additions & 0 deletions LICENSE.MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright 2017 Kenneth Reitz

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading