{ "info": { "author": "Ross Patterson", "author_email": "me@rpatterson.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Utilities" ], "description": "==========\nhttpd-echo\n==========\nA Simple Python HTTP server that echos the request in the response\n------------------------------------------------------------------\n\nProvide a simple HTTP server that tries to echo the request back in the\nresponse in the most sensible way possible. This can be useful for, testing,\ndebugging, stubbing out a local server in systems that have a hard-coded\nassumption of making HTTP requests, etc.::\n\n $ python -m httpdecho\n Echoing HTTP at http://localhost:8000 ...\n\nExamples\n--------\n\nWithout specifying a port, the server will try to find the next available port\nstarting at 8000 to try and be as predictable as possible::\n\n >>> import sys\n >>> import time\n >>> import subprocess\n >>> from six.moves import SimpleHTTPServer\n >>> startup_delay = 0.5\n >>> simple_popen = subprocess.Popen(\n ... [sys.executable, '-m', SimpleHTTPServer.__name__]\n ... ); time.sleep(1)\n >>> echo_popen = subprocess.Popen(\n ... [sys.executable, '-m', 'httpdecho']\n ... ); time.sleep(1)\n >>> echo_popen.poll()\n >>> simple_popen.kill()\n\nOnce running, HTTP requests are echoed in the responses. The default response\nbody format is basically HTTP header format, from\n``http.client.HTTPMessage``::\n\n >>> import io\n >>> import requests\n >>> import email\n >>> get_response = requests.delete('http://localhost:8001')\n >>> get_body = email.message_from_string(get_response.text)\n >>> print(get_body['Method'])\n DELETE\n >>> print(get_body['Path'])\n /\n >>> print(get_body.get_payload())\n \n\nQuery parameters are also included::\n\n >>> query_response = requests.get(\n ... 'http://localhost:8001', params=dict(Foo='foo'))\n >>> query_body = email.message_from_string(query_response.text)\n >>> print(query_body['Foo'])\n foo\n\nIf the request is a ``POST`` or another method that accepts a body on the\nrequest, the body or the responses body will contain the POST body::\n\n >>> post_response = requests.patch(\n ... 'http://localhost:8001', data=dict(Bar='bar'))\n >>> post_body = email.message_from_string(post_response.text)\n >>> print(post_body.get_payload())\n Bar=bar\n\nShutdown the server::\n\n >>> echo_popen.kill()\n\n\n----------------------------\nTODO\n----------------------------\nFeatures for future releases\n____________________________\n\n``Content-Type`` and ``Accept`` support for content negotiation:\n\n Return the response body in the format specified in the ``Accept`` header if\n given, otherwise in the same ``Content-Type`` as the request.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rpatterson/httpd-echo", "keywords": "httpd http echo server", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "httpd-echo", "package_url": "https://pypi.org/project/httpd-echo/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/httpd-echo/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rpatterson/httpd-echo" }, "release_url": "https://pypi.org/project/httpd-echo/0.1/", "requires_dist": null, "requires_python": null, "summary": "A Simple Python HTTP server that echos the request in the response", "version": "0.1" }, "last_serial": 2348140, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b331bcdd59bb5b60aadcd05acda93928", "sha256": "c95feb1186d499275f5099df2051454a4e9da8d9df2462c1616272431a7604dd" }, "downloads": -1, "filename": "httpd-echo-0.1.tar.gz", "has_sig": false, "md5_digest": "b331bcdd59bb5b60aadcd05acda93928", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2636, "upload_time": "2016-09-17T16:32:22", "url": "https://files.pythonhosted.org/packages/3e/56/1155fe039c13ab40496cddf469491f8137878edfb0929ee8b71e726283e4/httpd-echo-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b331bcdd59bb5b60aadcd05acda93928", "sha256": "c95feb1186d499275f5099df2051454a4e9da8d9df2462c1616272431a7604dd" }, "downloads": -1, "filename": "httpd-echo-0.1.tar.gz", "has_sig": false, "md5_digest": "b331bcdd59bb5b60aadcd05acda93928", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2636, "upload_time": "2016-09-17T16:32:22", "url": "https://files.pythonhosted.org/packages/3e/56/1155fe039c13ab40496cddf469491f8137878edfb0929ee8b71e726283e4/httpd-echo-0.1.tar.gz" } ] }