如何在httpie中设置重试次数?

时间:2017-05-14 19:10:02

标签: python httpie

如果第一次连接失败,如何告诉httpie重试n次?

1 个答案:

答案 0 :(得分:2)

我不认为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