Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set number of retries in httpie?

Tags:

python

httpie

How to tell httpie to retry for n times if the first connection failed?

like image 815
Googlebot Avatar asked Jan 18 '26 13:01

Googlebot


1 Answers

I don't think that httpie has this functionality built-in, but since it is just a command-line tool, you can use some sort of retry-method in whichever shell you use httpie... For example, in bash something like:

# 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
like image 188
errata Avatar answered Jan 21 '26 03:01

errata



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!