Skip to main content

一个轻量的重试包

Project description

一个轻量的重试包

实例代码

from zretry import retry
@retry
def fun():
    a = 1 / 0
fun() # 此时会不停的尝试调用直到成功, 每次尝试间隔一秒

限制尝试次数

from zretry import retry
@retry(max_attempt_count=5) # 最多尝试调用5次, 超出5次后报错
def fun():
    a = 1 / 0
fun()

参数说明

参数名 数据类型 默认值 描述
interval float 1 每次尝试间隔时间
max_attempt_count int None 最大尝试次数
result_retry_flag any None 如果调用的函数不报错, 它的返回值和result_retry_flag的id是同一个id, 则重试
error_callback function None 每次尝试错误都会回调这个函数, 它接收一个参数, 该参数表示尝试的是哪个函数

更新日志

发布时间 发布版本 发布说明
19-01-13 0.1.1 修复对类函数使用装饰器会导致调用时报错的bug
19-01-08 0.1.0 发布第一版

本项目仅供所有人学习交流使用, 禁止用于商业用途

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zretry-0.1.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file zretry-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zretry-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.5

File hashes

Hashes for zretry-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2fd49d63c69deb23f05cef3544da9fa02b293bdccd40eb24c59292a4bfd8cf8
MD5 12f624bcef837446b819909954b09323
BLAKE2b-256 0323cf5db00ef45a37cf6dfe00dca6ef6ce8acc8930eb0c604468e267eaa4068

See more details on using hashes here.

Supported by

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