Skip to main content
 首页 » 编程设计

python之如何在 httpie 中设置重试次数

2024年10月01日7EasonJim

如何分辨httpie第一次连接失败重试n次?

请您参考如下方法:

我认为 httpie 没有内置此功能,但由于它只是一个命令行工具,您可以在使用 httpie 的任何 shell 中使用某种重试方法...例如,在bash 类似于:

# Retry the 5 times command if returned exit code is not 0 
for i in {1..5}; do http httpie.orgs && break || echo "Retrying..."; done