I spent 30min debugging the script to finally find out the request was failing due to a trailing slash in Connection.Domain. Better error handling or perhaps a simple note in the docs to watch out for it would be great!
Now the result is an empty output.csv.