Code Monkey home page Code Monkey logo

httpbin's People

Contributors

derflocki avatar dshirley avatar exhuma avatar felixpalta avatar flaper87 avatar gaul avatar hartwork avatar hkosova avatar javabrett avatar johnsheehan avatar johtso avatar kennethreitz avatar kevin1024 avatar kyleconroy avatar luhkevin avatar lukasa avatar mansilladev avatar marekr22 avatar mgorny avatar mozillazg avatar msabramo avatar nateprewitt avatar rochacbruno avatar rochacon avatar sigmavirus24 avatar snh avatar steffenschroeder avatar the-compiler avatar umbrae avatar zsiciarz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

httpbin's Issues

Release a new version on Pypi with werkzeug 3 support

httpbin depends werkzeug which will werkzeug3.0, but parse_authorization_header has been removed from werkzeug.
So, we need a new release to make import httpbin corrent.

PS E:\PythonPrj\6xx\crud_test> python.exe -m pip install -U httpbin --proxy http://localhost:6666
Collecting httpbin
  Using cached httpbin-0.10.1-py2.py3-none-any.whl.metadata (6.1 kB)
Requirement already satisfied: Flask in c:\python312\lib\site-packages (from httpbin) (3.0.0)
Requirement already satisfied: brotlicffi in c:\python312\lib\site-packages (from httpbin) (1.1.0.0)
Requirement already satisfied: decorator in c:\python312\lib\site-packages (from httpbin) (5.1.1)
Requirement already satisfied: flasgger in c:\python312\lib\site-packages (from httpbin) (0.9.7.1)
Requirement already satisfied: werkzeug>=0.14.1 in c:\python312\lib\site-packages (from httpbin) (3.0.0)
Requirement already satisfied: six in c:\python312\lib\site-packages (from httpbin) (1.16.0)
Requirement already satisfied: greenlet>=3.0.0a1 in c:\python312\lib\site-packages (from httpbin) (3.0.0)
Requirement already satisfied: MarkupSafe>=2.1.1 in c:\python312\lib\site-packages (from werkzeug>=0.14.1->httpbin) (2.1.3)
Requirement already satisfied: cffi>=1.0.0 in c:\python312\lib\site-packages (from brotlicffi->httpbin) (1.16.0)
Requirement already satisfied: PyYAML>=3.0 in c:\python312\lib\site-packages (from flasgger->httpbin) (6.0.1)
Requirement already satisfied: jsonschema>=3.0.1 in c:\python312\lib\site-packages (from flasgger->httpbin) (4.19.1)
Requirement already satisfied: mistune in c:\python312\lib\site-packages (from flasgger->httpbin) (3.0.2)
Requirement already satisfied: packaging in c:\python312\lib\site-packages (from flasgger->httpbin) (23.2)
Requirement already satisfied: Jinja2>=3.1.2 in c:\python312\lib\site-packages (from Flask->httpbin) (3.1.2)
Requirement already satisfied: itsdangerous>=2.1.2 in c:\python312\lib\site-packages (from Flask->httpbin) (2.1.2)
Requirement already satisfied: click>=8.1.3 in c:\python312\lib\site-packages (from Flask->httpbin) (8.1.7)
Requirement already satisfied: blinker>=1.6.2 in c:\python312\lib\site-packages (from Flask->httpbin) (1.6.3)
Requirement already satisfied: pycparser in c:\python312\lib\site-packages (from cffi>=1.0.0->brotlicffi->httpbin) (2.21)
Requirement already satisfied: colorama in c:\python312\lib\site-packages (from click>=8.1.3->Flask->httpbin) (0.4.6)
Requirement already satisfied: attrs>=22.2.0 in c:\python312\lib\site-packages (from jsonschema>=3.0.1->flasgger->httpbin) (23.1.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\python312\lib\site-packages (from jsonschema>=3.0.1->flasgger->httpbin) (2023.7.1)
Requirement already satisfied: referencing>=0.28.4 in c:\python312\lib\site-packages (from jsonschema>=3.0.1->flasgger->httpbin) (0.30.2)
Requirement already satisfied: rpds-py>=0.7.1 in c:\python312\lib\site-packages (from jsonschema>=3.0.1->flasgger->httpbin) (0.10.6)
Using cached httpbin-0.10.1-py2.py3-none-any.whl (100 kB)
Installing collected packages: httpbin
Successfully installed httpbin-0.10.1

Error:

File "e:\xx\libs\aioquic-main\examples\http3_server.py", line 560, in <module>
  module = importlib.import_module(module_str)
File "e:\xx\libs\aioquic-main\examples\demo.py", line 9, in <module>
  import httpbin
File "c:\python312\lib\site-packages\httpbin\__init__.py", line 3, in <module>
  from .core import *
File "c:\python312\lib\site-packages\httpbin\core.py", line 35, in <module>
  from werkzeug.http import parse_authorization_header

builtins.ImportError: cannot import name 'parse_authorization_header' from 'werkzeug.http' (c:\Python312\Lib\site-packages\werkzeug\http.py)

Flaky CI runs

          Some of the test runs have been a bit flaky.  Not sure what the deal is.  Thanks for your PRs though!

Originally posted by @kevin1024 in #11 (comment)

I've looked into the CI definition and saw just now that the jobs have a timeout of 10 minutes:

timeout-minutes: 10

This confirms my suspicion from my earlier post. I've noticed on a friend's laptop that docker is painfully slow on macOS. And - with an educated guess - I assume that the GitHub CI jobs run on docker containers.

This might explain the failures I had above. What do you think about either removing the timeout or increasing it considerably? Maybe we could remove it to get a rough feeling of how long those jobs take?

Q: tagging convention

Looks like tagging convention has been changes from v<version> to release-v<version>.
Accident or from now it will be always like release-v<version>? ๐Ÿค”

Allow starting the process on a non-provileged port

Currently, port 80 is hard-coded. This is no allowed on some deployment environments (f.ex. OpenShift).

Please provide a way to change that port upon startup. For example using an environment variable.

TypeError: load() missing 1 required positional argument: 'Loader'

Building the image from the current main branch (c62ab87) is non-functional due to a pyyaml exception. The exception appears when running the image that is built from the referenced branch and when a GET is executed on /.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.6/dist-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/flask/views.py", line 158, in dispatch_request
    return meth(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/flasgger/base.py", line 204, in get
    optional_fields, self.process_doc)
  File "/usr/local/lib/python3.6/dist-packages/flasgger/utils.py", line 132, in get_specs
    method, sanitizer, endpoint=rule.endpoint, verb=verb)
  File "/usr/local/lib/python3.6/dist-packages/flasgger/utils.py", line 528, in parse_docstring
    swag = yaml.load(full_doc[yaml_sep + 4:])
TypeError: load() missing 1 required positional argument: 'Loader'

Please update project homepage on PyPI

Just sent @kevin1024 an email after finding a new release on PyPI and being worried that the PyPI account had been hacked and a malicious package uploaded (since the PyPI page still links to the postman org, which hasn't shown activity in years as you well know).

Thanks for keeping this project alive!

Unable to build the docker image

I'm currently unable to build the docker image. It fails with errors running pipenv caused by Python 3.6 (from the base-image)

Upgrading to a Python 3.11 base-image fails with new errors. They arrive because pipenv has a new CLI interface (different sub-commands). Once those are fixed, the next issue is cause by markupsafe. If I remember correctly, this is an older known issue with markupsafe that has been fixed in the mean-time.

It might be worthwile to upgrade to the latest versions of everything. Especially considering that the project has not been active for 5 years. I'll see if I can do something about that in a PR

Unable to pull or run docker image

Running docker commands as copied from readme:

> docker run -p 80:8080 ghcr.io/psf/httpbin
Unable to find image 'ghcr.io/psf/httpbin:latest' locally
docker: Error response from daemon: Head "https://ghcr.io/v2/psf/httpbin/manifests/latest": unauthorized.
See 'docker run --help'.
> docker pull ghcr.io/psf/httpbin
Using default tag: latest
Error response from daemon: Head "https://ghcr.io/v2/psf/httpbin/manifests/latest": unauthorized

Environment:

Ubuntu 22.04.x up to date

> docker --version
Docker version 24.0.5, build ced0996

Project & packaging house-keeping

NOTE: If there is interest, I can take care of the points noted below via a PR:


The project currently contains a setup.py, a pyproject.toml and a Pipfile. To some degree, the docker-compose.yaml and Dockerfile could also be included in the "packaging" topic.

If there is an interest, I could look into consolidation of all those files. For example, with PEP-517, we could put everything into pyproject.toml. Currently the project uses both setuptools and pipenv for dependency management. As setuptools can do most, it might be beneficial to remove both setup.py and Pipfile in favor of pyproject.toml.

pipenv does offer a few convenient commands though and might still remain useful. An alternative (for locking) could be pip-compile (from pip-tools). pip-tools would be a tad more lightweight. But as it does not offer any real added value I don't mind sticking with pipenv.

The docker-compose file is not referenced anywhere in the project so it might just be a leftover from an older revision. I don't see any practical use of it at this moment and it could be removed for cleanup.

Fails to import with werkzeug 3.0

This is a heads-up that werkzeug 3.0 was released a few hours ago and httpbin fails on import.

Looks like the relevant change is in here: pallets/werkzeug#2619

httpbin> Traceback (most recent call last):
httpbin>   File "<string>", line 1, in <module>
httpbin>   File "<string>", line 1, in <lambda>
httpbin>   File "/nix/store/mlzs555x59i8vk160d2yr683mwcacscc-python3-3.11.5/lib/python3.11/importlib/__init__.py", line 126, in import_module
httpbin>     return _bootstrap._gcd_import(name[level:], package, level)
httpbin>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
httpbin>   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
httpbin>   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
httpbin>   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
httpbin>   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
httpbin>   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
httpbin>   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
httpbin>   File "/nix/store/wckwd80x7b1fnpkyngcf45rq4lz997w4-python3.11-httpbin-0.10.1/lib/python3.11/site-packages/httpbin/__init__.py", line 3, in <module>
httpbin>     from .core import *
httpbin>   File "/nix/store/wckwd80x7b1fnpkyngcf45rq4lz997w4-python3.11-httpbin-0.10.1/lib/python3.11/site-packages/httpbin/core.py", line 35, in <module>
httpbin>     from werkzeug.http import parse_authorization_header
httpbin> ImportError: cannot import name 'parse_authorization_header' from 'werkzeug.http' (/nix/store/mg6vcsnplj56nyjlzzjph2wxrsc9449n-python3.11-werkzeug-3.0.0/lib/python3.11/site-packages/werkzeug/http.py)

Make flasgger optional?

Hi! I'm a packager for Fedora. We've run into a bit of a roadblock trying to update Fedora's httpbin package: https://bugzilla.redhat.com/show_bug.cgi?id=2233128#c9

since the last version we packaged, httpbin grew a hard dependency on flasgger. flasgger is not packaged for Fedora and is a bit tricky to package because it contains several bundled, pre-minified javascript libraries, which is against Fedora's packaging guidelines. (They are also, I'll note, ancient - upstream hasn't updated the bundled libraries for ui2 or ui3 since it added them, six and five years ago respectively.)

We can probably work around this if necessary (perhaps by only packaging ui3, the one httpbin uses, which is simpler as it only bundles jquery 2.x), but another option is to look at having httpbin not use flasgger. It doesn't seem, strictly speaking, to be necessary - all it does (AIUI) is provide API docs in the web UI, which is neat but not critical. Especially not since the main reason we package httpbin in Fedora is as a dependency of requests' test suite - no human is looking at API docs in a web UI there.

Would it be acceptable to send a patch to make the flasgger dependency optional, and just skip all the flasgger setup stuff in httpbin/core.py if it's not present?

Tag a new release to provide a published docker image

With the recent changes, would it be possible to get a release tagged to make the official docker-image available?

We're planning to deploy a container based on this image internally, and sitting behind a corporate firewall makes it fiddly to build the image due to issues with pip downloads. A docker image would pass through our vetted docker proxy and would simplify this a lot.

RFE: please provide update for `werkzeug` 3.x

Looks like latest version test suite is not ready for latest werkzeug 3.0.0

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpbin-0.10.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpbin-0.10.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/httpbin-release-v0.10.1
collected 0 items / 1 error

========================================================================================== ERRORS ===========================================================================================
__________________________________________________________________________ ERROR collecting tests/test_httpbin.py ___________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/httpbin-release-v0.10.1/tests/test_httpbin.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_httpbin.py:12: in <module>
    import httpbin
httpbin/__init__.py:3: in <module>
    from .core import *
httpbin/core.py:35: in <module>
    from werkzeug.http import parse_authorization_header
E   ImportError: cannot import name 'parse_authorization_header' from 'werkzeug.http' (/usr/lib/python3.8/site-packages/werkzeug/http.py)
================================================================================== short test summary info ==================================================================================
ERROR tests/test_httpbin.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================================== 1 error in 0.26s ======================================================================================

sdist is missing `tox.ini`

The sdist package at PyPI is missing tox.ini file. File add the missing file to dist to make downstream testing easier. Thank you.

Replace "developer" links in httpbin?

I've noticed that the main page of httpbin still links to the website and email of Kenneth Reitz. Since they no longer reply on the topic of the project, perhaps we should replace them? Maybe just replace both with a link to this GitHub repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.