
Python实用工具
学生1号
爱好程序,致力于编写出美妙代码的人群之一。年轻气盛,要玩转世界,希望前辈和道友们不吝指教。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
多线程的timeout
def with_timeout(timeout=0, exception=TTimeout): def async_raise(target_tid, exc): """Raises an asynchronous exception in another thread. Read http://docs.python.org/c-api/init.ht...原创 2018-08-23 16:40:12 · 1074 阅读 · 0 评论 -
自动记录状态的库(线程安全,非进程安全)
# encoding=utf8 import threading import time class AutoKnight(object): def __init__(self, retry_times=5, retry_delay=60, disabled_delay=600, disable_run_times=20, disable_warning=[], ...原创 2018-09-04 12:57:48 · 195 阅读 · 0 评论 -
检测
import socket def _check_bootstrap_server(broker_list): pattern = re.compile(r'.*?\[?([0-9a-zA-Z\-%._:]*)\]?:([0-9]+)') for host_and_port in broker_list: match = p...翻译 2018-12-07 11:55:17 · 260 阅读 · 0 评论 -
自动熔断 python
# encoding=utf8 import time import json import logging import threading from random import random import redis class AutoKnightError(Exception): pass class AutoKnight(object): """ judg...原创 2019-03-25 17:57:20 · 1697 阅读 · 0 评论