{ "info": { "author": "Rowen Felt, Zebediah Millslagle", "author_email": "rowenfelt@gmail.com, zmillslagle@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# httpantry\nHttpantry is a set of tools for caching RESTful API calls in development environments.\n\nThe pip package contains two components: a Flask proxy server and a wrapper module for the Python Requests library.\n\n### Running the Proxy Server\n\nYou can run the Flask proxy server from the command line using:\n\n```httpantry server```\n\nThis command will create a directory named ```__httpantry_cache__``` containing the cache database ```proxy_database.db```, the configuration file ```config```, and the custom responses file ```custom_responses.json```.\n\nTo start caching responses, simply point your requests at the proxy server using ```http://localhost:```, where `````` is the specified port number in the configuration file.\n\nThe server can be killed at any time. To remove the cache directory and all contents, including configurations and custom responses, run:\n\n```httpantry cleanup```\n\n##### Note: the proxy server cannot proxy HTTPS requests. For HTTPS requests, please consider using the wrapper functionality for the Requests library.\n\nTo create the ```__httpantry_cache__``` directory and populate it with the default infrastructure without running the proxy server or importing the wrapper functions, run:\n\n```httpantry init```\n\nTo flush the cache, run:\n\n```httpantry flush```\n\n### Using the wrapper functions\n\nThis package contains wrapper functions for the user-facing API of the Python Requests library. These wrapper functions include:\n```\nrequests.get()\nrequests.put()\nrequests.post()\nrequests.delete()\nrequests.patch()\n```\n\nIf your code is using the Requests library, you can simply replace \n```import requests``` with ```import httpantry as requests```.\nAfter switching the imports, all requests and associated responses through the functions enumerated above will be cached, and all other function calls will be forwarded to the correction function in the Requests library.\n\nThe wrapper functions will also create the cache directory on import. The directory can be deleted easily using the command:\n```httpantry cleanup```\n\n### Configurations\n\nBoth the wrapper functions and proxy server will parse configurations from a ```config``` file in the ```__httpantry_cache___``` directory. If one does not exist there, one will be created with the following default configurations:\n\n```\n[GENERAL]\nport_number = 5000\npersistence = True\nuncached_apis = yourmom.com http://httpbin.org/image/jpeg\n\n[CUSTOM_RESPONSES]\nuse_custom_responses = True\nfile_name = __httpantry_cache__/custom_responses.json\n\n[TIMEOUT]\ndays = 0\nhours = 1\nminutes = 0\nseconds = 0\nmilliseconds = 0\n```\n\n```port_number``` specifies the port number of the proxy server.\n```persistence``` specifies whether the responses should be stored in a persistent database or not.\n```uncached apis``` is a space-delimited list of URLs. Any API call to a URL in this list will not be cached.\nThe ```[TIMEOUT]``` section specifies the length of time for which a response can be considered valid. Responses are not deleted from the database upon timeout. Instead, they will be resolved again, and the new response will be stored.\n\n### Custom Responses\n\nhttpantry allows for customized responses. These responses are recorded in ```__httpantry_cache___/custom_responses.json```. They consist of the ```method```, ```url```, and ```content``` of the response. If the file does not exist when the module is imported, it will be created with the following example content:\n\n```json\n[\n {\n \"method\": \"GET\",\n \"url\": \"http://fakeurl.org/get\",\n \"content\": {\n \"args\": {},\n \"headers\": {\n \"Accept\": \"*/*\",\n \"Accept-Encoding\": \"gzip, deflate\",\n \"Host\": \"fakeurl.org\",\n \"User-Agent\": \"python-requests/2.21.0\"\n },\n \"url\": \"http://fakeurl.org/get\"\n }\n }\n]\n```\n\nAuthors: Rowen Felt and Zebediah Millslagle", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/RowenFelt/httpantry", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "httpantry", "package_url": "https://pypi.org/project/httpantry/", "platform": "", "project_url": "https://pypi.org/project/httpantry/", "project_urls": { "Homepage": "https://github.com/RowenFelt/httpantry" }, "release_url": "https://pypi.org/project/httpantry/0.0.6/", "requires_dist": null, "requires_python": "", "summary": "Caches HTTP requests for faster, more efficient development", "version": "0.0.6" }, "last_serial": 5245601, "releases": { "0.0.6": [ { "comment_text": "", "digests": { "md5": "5b36920ce562665960e93bc07e270598", "sha256": "8f9c2dbfba72d0e64b74f6429a215a8624c9e5b7c908b1cccf9a7ec481d71aad" }, "downloads": -1, "filename": "httpantry-0.0.6.tar.gz", "has_sig": false, "md5_digest": "5b36920ce562665960e93bc07e270598", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7094, "upload_time": "2019-05-09T03:50:19", "url": "https://files.pythonhosted.org/packages/7d/6d/554037296c9dddffea91f1b79f542ffc901096d708b9a6911f4891f82733/httpantry-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5b36920ce562665960e93bc07e270598", "sha256": "8f9c2dbfba72d0e64b74f6429a215a8624c9e5b7c908b1cccf9a7ec481d71aad" }, "downloads": -1, "filename": "httpantry-0.0.6.tar.gz", "has_sig": false, "md5_digest": "5b36920ce562665960e93bc07e270598", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7094, "upload_time": "2019-05-09T03:50:19", "url": "https://files.pythonhosted.org/packages/7d/6d/554037296c9dddffea91f1b79f542ffc901096d708b9a6911f4891f82733/httpantry-0.0.6.tar.gz" } ] }