{ "info": { "author": "Drew Thomson", "author_email": "drooby@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-webcache\n===============\n\ndjango web caching app that supports throttling, expiration and\ncompression.\n\nThis uses code from django 1.6 for throttling transactions. If you\nare using django 1.5 or lower you might get lucky enough to hit the race\ncondition if there are concurrent requests. In this event, it will just\nskip the throttle on that lookup.\n\nInstall\n-------\n\n.. code-block:: python\n\n pip install django-webcache\n\nUsage\n-----\n\nAll variables **except url** have defaults that can be overridden in the\nsettings.py file\n\n.. code-block:: python\n\n from urlopen import cache\n from urlopen import throttle\n from urlopen import cache_and_throttle\n\nCache\n-----\n\n.. code-block:: python\n\n cache(url[, data=postdata][, location=\"path\"][, expires=n |, expires=(n,m)][, overwrite=False][, compression=False])\n \n+-------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+\n| variable | type | description |\n+=============+=====================================+===============================================================================================================================+\n| url | string | The url to retrieve / cache |\n+-------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+\n| data | string | urlencoded POST data string |\n+-------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+\n| location | string | The directory to save the cached pages to |\n+-------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+\n| expires | integer or 2 item tuple of integers | Number of seconds until the cache expires, or a range from which a random number of seconds will be chosen for the expiration |\n+-------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+\n| overwrite | boolean | Retrieve url and cache even if cache already exists |\n+-------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+\n| compression | string | Compress the cache |\n+-------------+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+\n\nThrottle\n--------\n\n.. code-block:: python\n\n throttle(url[, data=postdata][, delay=n |, delay=(n,m)])\n\n+---------------+---------------------------------------+-------------------------------------------------------------------------------------------------+\n| variable | type | description |\n+===============+=======================================+=================================================================================================+\n| url | string | The url to retrieve / cache |\n+---------------+---------------------------------------+-------------------------------------------------------------------------------------------------+\n| data | string | urlencoded POST data string |\n+---------------+---------------------------------------+-------------------------------------------------------------------------------------------------+\n| delay | integer or 2 item tuple of integers | Number of seconds to throttle, or a range from which a random number will be chosen to throttle |\n+---------------+---------------------------------------+-------------------------------------------------------------------------------------------------+\n\n\nCache and Throttle\n------------------\n\n.. code-block:: python\n\n cache_and_throttle(url[, data=postdata][, location=\"path\"][, expires=n |, expires=(n,m)][, overwrite=False][, compression=False][, delay=n |, delay=(n,m)])\n\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n| variable | type | description |\n+===============+=======================================+=================================================================================================================================+\n| url | string | The url to retrieve / cache |\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n| data | string | urlencoded POST data string |\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n| location | string | The directory to save the cached pages to |\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n| expires | integer or 2 item tuple of integers | Number of seconds until the cache expires, or a range from which a random number of seconds will be chosen for the expiration |\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n| overwrite | boolean | Retrieve url and cache even if cache already exists |\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n| compression | string | Compress the cache |\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n| delay | integer or 2 item tuple of integers | Number of seconds to throttle, or a range from which a random number of seconds will be chosen to throttle |\n+---------------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+\n\nExamples\n--------\n\n.. code-block:: python\n\n import webcache.urlopen\n import urllib\n\n pyurl = \"http://www.python.org/\"\n\n \"\"\"just caching\"\"\"\n response = urlopen.cache(pyurl)\n \n \"\"\"caching with post data\"\"\"\n postdata = urllib.urlencode({\"name\": \"value\"})\n response = urlopen.cache(pyurl, data=postdata)\n\n \"\"\"cache and override default cache file directory\"\"\"\n response = urlopen.cache(pyurl, location=self.path)\n\n \"\"\"cache and override default expiration time in seconds\"\"\"\n response = urlopen.cache(pyurl, expires=10)\n\n \"\"\"cache and override default overwrite setting\n will overwrite old cache even if not expired\"\"\"\n response = urlopen.cache(pyurl, overwrite=True)\n\n \"\"\"cache and override default compression with gzip compression\"\"\"\n response = urlopen.cache(pyurl, compression='gzip')\n\n \"\"\"throttle will wait 10 seconds since the previous web page retrieval of something\n from the same site. For example http://www.python.org/about will throttle if\n another lookup of http://www.python.org exists in the last 10 seconds\"\"\"\n response = urlopen.throttle(pyurl, delay=10)\n\n \"\"\"throttle using random range\"\"\"\n response = urlopen.throttle(pyurl, delay=(60, 120))\n\n \"\"\"combination of cache and throttle\"\"\"\n response = urlopen.cache_and_throttle(pyurl, location=self.path, delay=10)\n\nDeveloped By\n============\n\n- Drew Thomson - drooby@gmail.com\n\nSpecial Thanks\n==============\n\n- Staffan Malmgren\n- His original code:\n http://code.activestate.com/recipes/491261-caching-and-throttling-for-urllib2/\n\nLicense\n=======\n\nThe MIT License (MIT)\n\nCopyright (c) 2013 Drew Thomson\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "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/dcthomson/django-webcache", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "django-webcache", "package_url": "https://pypi.org/project/django-webcache/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-webcache/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/dcthomson/django-webcache" }, "release_url": "https://pypi.org/project/django-webcache/0.1.8/", "requires_dist": null, "requires_python": null, "summary": "A django web caching app that supports throttling, expiration and compression.", "version": "0.1.8" }, "last_serial": 950042, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "7661a5d581df5242001ddd4ce00a57f2", "sha256": "5de91f7b45cda85f158d8234528ae198cb980b42fcd883e29302f4c0271782c5" }, "downloads": -1, "filename": "django-webcache-0.1.tar.gz", "has_sig": false, "md5_digest": "7661a5d581df5242001ddd4ce00a57f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9770, "upload_time": "2013-12-18T09:52:20", "url": "https://files.pythonhosted.org/packages/34/60/40248a560cf4cc8eca7463c036f5063ce0ef246270f433f7b0c78be059c5/django-webcache-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "78a75e055cf7272bf734805f3c2701f6", "sha256": "f580942b75fe0da4b3ada6a0e1ce45b7952f5464055d1f3f8c154692b2ccce80" }, "downloads": -1, "filename": "django-webcache-0.1.1.tar.gz", "has_sig": false, "md5_digest": "78a75e055cf7272bf734805f3c2701f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9770, "upload_time": "2013-12-18T10:00:20", "url": "https://files.pythonhosted.org/packages/3a/83/341ec7a1f077cfb483d57eff45ca8ca7d21d533ba69ff177742a293800d9/django-webcache-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "28e5e27747852275972d82ccaae9cffc", "sha256": "03f27e0c462b29174034fb30ba957f14396521926022034e7ebb246138400839" }, "downloads": -1, "filename": "django-webcache-0.1.2.tar.gz", "has_sig": false, "md5_digest": "28e5e27747852275972d82ccaae9cffc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9798, "upload_time": "2013-12-18T18:43:53", "url": "https://files.pythonhosted.org/packages/0e/4b/8d60667a8da51fc014a58466e84ef940f461cbebff84e744455bf5d587fb/django-webcache-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "b8f53561a7c7a48f148c2096483fa0f9", "sha256": "40f9dbdb865b61079da042086e1ee6a30a40f9b1d17038d0b67f077992c91699" }, "downloads": -1, "filename": "django-webcache-0.1.3.tar.gz", "has_sig": false, "md5_digest": "b8f53561a7c7a48f148c2096483fa0f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9873, "upload_time": "2013-12-18T18:57:53", "url": "https://files.pythonhosted.org/packages/5e/59/af7194f6dc50ffbca43641554edeeec45a8e08f6c1e74475479ba31d27e1/django-webcache-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "e8aa814a05c782b27de1ec1d23012fb6", "sha256": "1b9716db684d812cf3a7d9f7fb9f8889e1fd02dba85d422297f2cbedf2da367b" }, "downloads": -1, "filename": "django-webcache-0.1.4.tar.gz", "has_sig": false, "md5_digest": "e8aa814a05c782b27de1ec1d23012fb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9955, "upload_time": "2013-12-18T19:50:41", "url": "https://files.pythonhosted.org/packages/b6/28/065512e2cb4c97023f3add6cdb45c823810b8c2c8e1bd7b1b2a4076ebe4e/django-webcache-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "0f07f092543cc8f36792acc6b7f0ded8", "sha256": "3b6d29ecbf41c04937046c472385c72a21436516ccd236071f42bf887e25c3bd" }, "downloads": -1, "filename": "django-webcache-0.1.5.tar.gz", "has_sig": false, "md5_digest": "0f07f092543cc8f36792acc6b7f0ded8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10088, "upload_time": "2013-12-18T23:33:54", "url": "https://files.pythonhosted.org/packages/ee/34/b8585da91f74215a469abcbecd7ad203d34d88d9f98ed4c8a3dc06549ad5/django-webcache-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "1c267f0d81d5485fad00ab69167366bd", "sha256": "7a9528f695a5580a009c663f2a8d3be5bf2afa6e20e0f446dc592e7d27a89eed" }, "downloads": -1, "filename": "django-webcache-0.1.6.tar.gz", "has_sig": false, "md5_digest": "1c267f0d81d5485fad00ab69167366bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10067, "upload_time": "2013-12-19T07:16:33", "url": "https://files.pythonhosted.org/packages/62/d5/374699803a6d764e8986fc737d2dd1618f0e4dc29123bffff3bebfd9dc12/django-webcache-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "097ebc57f3da37e84c438078af796adc", "sha256": "bbd3cee715e19c9b2822e664c76c0c40db9327efb072848e546f779799ab4989" }, "downloads": -1, "filename": "django-webcache-0.1.7.tar.gz", "has_sig": false, "md5_digest": "097ebc57f3da37e84c438078af796adc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10092, "upload_time": "2013-12-19T07:29:47", "url": "https://files.pythonhosted.org/packages/7d/ef/97aab1d386df1ab6da5473230aab3a34f1c5bee3f9353f4b9152d9b6d9aa/django-webcache-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "fa8af13ba862ae076060a20ff10e2784", "sha256": "b08650946ef2bc37ff5ad32f0c06a07e55d58151cc15d81f58aa4c6bd8282f52" }, "downloads": -1, "filename": "django-webcache-0.1.8.tar.gz", "has_sig": false, "md5_digest": "fa8af13ba862ae076060a20ff10e2784", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10122, "upload_time": "2013-12-20T20:20:50", "url": "https://files.pythonhosted.org/packages/2b/4a/c1faaa6c2f055b37100548207d5ad2d6f67e0a5535d2b788c09b3e819b30/django-webcache-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fa8af13ba862ae076060a20ff10e2784", "sha256": "b08650946ef2bc37ff5ad32f0c06a07e55d58151cc15d81f58aa4c6bd8282f52" }, "downloads": -1, "filename": "django-webcache-0.1.8.tar.gz", "has_sig": false, "md5_digest": "fa8af13ba862ae076060a20ff10e2784", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10122, "upload_time": "2013-12-20T20:20:50", "url": "https://files.pythonhosted.org/packages/2b/4a/c1faaa6c2f055b37100548207d5ad2d6f67e0a5535d2b788c09b3e819b30/django-webcache-0.1.8.tar.gz" } ] }