Skip to main content

Provide an intermediate response when a WSGI application slow to respond

Project description

Status And License

Wait For It is distributed under an MIT-style license. It is by Ian Bicking. Questions can go to the Paste mailing list; bugs can be reported in the Paste Bug Tracker.

What It Does

Wait For It gives users a timely response even when the underlying WSGI application isn’t very timely. Wait For It does this by launching an extra thread for each incoming request. If the wrapped application responds in a timely manner (before time_limit) the response is simply passed on.

If the response doesn’t come back before the time limit, the user is given a response page that asks them to wait. The response page contains Javascript that will re-check the status of the page, and when the page is ready it will reload the page.

Applications can provide feedback to users by looking for environ['waitforit.progress'] and putting information in there. In particular "message" contains an HTML message for the user (e.g., if you want to show what step the long-running application is working on). "percent" is used for a progress bar; it should be a number from 0 to 100. The value in progress is sent via JSON, so you should use only strings (preferably unicode), integers, floats, dictionaries (with string keys) and lists.

Using It

Wrap you application like this:

from waitforit import WaitForIt

fast_app = WaitForIt(slow_app, time_limit=5, poll_time=10)

Then if slow_app takes longer than 5 seconds, a transition page is shown. The transition page checks to see if the response is done every 10 seconds. (The default values for both parameters is 10 seconds.)

Download & Installation

You can install with easy_install WaitForIt. You can also install the most recent code from trunk with easy_install WaitForIt==dev. You can see the most recent code in the svn repository, or check it out like:

svn co http://svn.pythonpaste.org/Paste/WaitForIt/trunk WaitForIt

Example

To see a simple example, see waitforit.testapp. You can run it like python waitforit/testapp.py (or if you are using Python 2.5, python -m waitforit.testapp).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WaitForIt-0.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

WaitForIt-0.1-py2.4.egg (12.7 kB view details)

Uploaded Source

File details

Details for the file WaitForIt-0.1.tar.gz.

File metadata

  • Download URL: WaitForIt-0.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for WaitForIt-0.1.tar.gz
Algorithm Hash digest
SHA256 9e86fc9f977d06f639324434552dbd233b5b4e20c434540c476c098614296b35
MD5 e3f88fed01b55e524c0d341ea6104b79
BLAKE2b-256 306d9a712f7df51dbf912d4191cf3aeb93e7068286d4532c251fb30813aee468

See more details on using hashes here.

File details

Details for the file WaitForIt-0.1-py2.4.egg.

File metadata

  • Download URL: WaitForIt-0.1-py2.4.egg
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for WaitForIt-0.1-py2.4.egg
Algorithm Hash digest
SHA256 208b2e8e4d3410721a7023a966ccfaa3c3cdd0b67870f21adae7a35ff7124872
MD5 0630d6aac87dfd482ed22e116f49bc1e
BLAKE2b-256 267be8cca4e8e1136c742d630b2b52a5ebcf257982da1d12fa79cd7a1926d6b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page