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

Python 如何在httpie中设置重试次数?,python,httpie,Python,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

如果第一次连接失败,如何判断是否重试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