introducemyself

in #introduceyourself5 years ago

introducemyself

Hi Steem! My name is ool. This is my first contact with this platform.
I know that there are many people who know technology.So I came here!
Share a great tool today, based on the python!

Tenacity

Tenacity is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything.

简单的来说 就是一个装饰器来完成处理异常并重试的功能

举个简单的例子如下:

import random
from tenacity import retry

@retry
def do_something_unreliable():
    a = random.randint(0, 10)
    print(a)
    if a > 5:
        raise IOError("Broken sauce, everything is hosed!!!111one")
    else:
        return "Awesome sauce!"

print(do_something_unreliable())

执行结果如下:

9
8
4
Awesome sauce!

上面的意思,就是 ,当随机的值大于5的时候发生异常,会继续执行这个函数,直到小于等于5的时候得到一个返回值。

有很多用途,比如写爬虫的时候,出现异常就会断掉 ,对程序的影响很大。有了这个类库就简单的多了

Sort:  

Welcome

thank you!

welcome

Posted using Partiko Android

thanks!

welcome to steem!

Posted using Partiko iOS

thanks!

welcome to steem!!!

thanks!

欢迎欢迎

谢谢 谢谢

欢迎加入

谢谢 谢谢

Hello, ool, you're welcome. Keep going and enjoy it.

thank you!

Welcome ool!
eSteem is the application that improves your experience here. We have Mobile application for Android and iOS users. We also have developed Surfer Desktop application that helps you to gain new followers and stay connected with your friends, unique features - notifications, bookmarks, favorites, drafts, and more.
We reward our users with encouragement upvotes as well as monthly giveaways rewarding Spotlight top users and active Discord users.
Learn more: https://esteem.app
Join our discord: https://discord.gg/8eHupPq

thank you !

Welcome to Steem ool! Partiko is officially the fastest and most popular mobile app for Steem. Unlike other Steem apps, we take 0% cut of your earnings! You can also be rewarded with Partiko Points while using Partiko and exchange Partiko Points for upvotes!

Partiko for Android can be downloaded here on Google Play and the iOS version is available here on the App Store.

If you have more questions, feel free to join our Discord channel and ask @crypto.talk, we're always here to help!

Thank you so much for your interest!

Hi @ool, Welcome to the steemit platform. Hope you can have fun here. Please follow me and if you need help, I will help you.

Posted using Partiko Android

thank you and I have followed you.

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 62559.43
ETH 3092.10
USDT 1.00
SBD 3.86