plumbum
plumbum copied to clipboard
How to check for retcode when perform stdout redirect
I want to do something like this:
- downloading a file by redirecting curl output to the file and checking curl retcode
I have try this syntax, and I'm probably doing something wrong, but I cannot find out the correct way to achieve this.
(curl('https://www.mysite.com/file', retcode=0) > 'file.txt')()
This version is working: (curl['https://www.mysite.com/file'] > 'file.txt')()
Any help greatly appreciated. Thanks.