4 ms·
Does Ruby not have a good HTTP library? Why would you ever shell out to curl?
by tghw 12y ago
Does Ruby not have a good HTTP library? Why would you ever shell out to curl?
- zrail 12y agoBecause I'm lazy, basically. I already had a working curl command, I just wanted to make it sanity check my arguments. Also, in my experience convincing the various Ruby libraries to do multipart form uploads (for the documents themselves) is sort of a pain (but if there's an alternative I would love to hear it!)
- tghw 12y agoSorry, can't make any Ruby suggestions. I spend more time in the Python world where we have requests[0], which makes it all dead simple. For example, multipart file uploads looks like: files = {'filename[]': open(filename, 'rb')} data = {'to': to, 'api_key': api_key, 'api_secret': api_secret} response = requests.post(url, data=data, files=files) [0]http://docs.python-requests.org/en/latest/ http://docs.python-requests.org/en/latest/