Skip to main content

Based on https://github.com/jgillick/python-pause

Suspend the execution of your program for a given amount of time using asyncio. This works similarly to time.sleep, but uses your computers timestamp to track time, versus a counter.

For example, traditionally using time.sleep(3600), will pause the program for 60 minutes. If your computer goes into standby mode during minute one, and wakes up several hours later, your program will continue to be paused for 59 minutes.

On the other hand, with pause.seconds(3600), if your computer goes into standby mode for several hours, the program will continue immediately after the machine wakes back up since the minimum amount of time has passed since the pause was started.

How it works

When you create a pause, it will determine what the end time of that pause should be. Then a loop will be started that will continually check the current time against the end time. When the current time is equal or greater than the end time, the method will allow your program can resume.

Precision

The precision should be within 0.001 of a second, however, this will depend on how precise your system sleep is and other performance factors.

This module computes the pause duration between now and the future date, and then sleeps for half of this duration. After this time, it recomputes the new pause duration, repeating this process until the desired time is reached.

Install

Download the source code and run the following command:

sudo python ./setup.py install

Or, without downloading, install with pip:

sudo pip install asyncio-pause

Examples:

Pause for half a second:

import asyncio-pause
await pause.milliseconds(500)

Or:

import asyncio-pause
await pause.seconds(0.5)

Pause for 1 minute:

import asyncio-pause
await pause.minutes(1)

Pause for 2 days:

import asyncio-pause
await pause.days(2)

Pause until a unix time, with millisecond precision:

import asyncio-pause
await pause.until(1370640569.7747359)

Pause using datetime:

import asyncio-pause, datetime
dt = datetime.datetime(2013, 6, 2, 14, 36, 34, 383752)
await pause.until(dt)

Functions

  • days(num)

    Pause for this many days

  • hours(num)

    Pause for this many hours

  • milliseconds(num)

    Pause for this many milliseconds

  • minutes(num)

    Pause for this many minutes

  • seconds(num)

    Pause for this many seconds

  • time(num)

    Same as PauseFor.seconds()

  • until(time)

    Pause your program until a specific end time. ‘time’ is either a unix timestamp in seconds (i.e. seconds since Unix epoch) or datetime object

  • weeks(num)

    Pause for this many weeks

Metadata

Release files for asyncio-pause 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncio-pause 0.5
File Size Uploaded Provenance
asyncio-pause-0.5.tar.gz 5.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for asyncio-pause 0.5
File Interpreter ABI Platform
asyncio_pause-0.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / asyncio-pause-0.5.tar.gz

Download URL asyncio-pause-0.5.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c45ff06b33adb0405d25912246e66929629003d4c641d2cb8ec0fc2519cf2fb7
BLAKE2b-256 checksum
How to use checksums
e3e599439bdcdfb788633f39ac259f7916130bd2fa6c02a18eb4369c42917b31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.5

Release files / asyncio_pause-0.5-py3-none-any.whl

Download URL asyncio_pause-0.5-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f407ec64c82c69bfd1097edce63c15796e53efd82d665d35cdc462126686030a
BLAKE2b-256 checksum
How to use checksums
8b899a7fdfb011941218129e5128437600595d3fbe658b5f63747e7306fdb2c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.5

Security for asyncio-pause 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page