Closed Hoedic closed 10 years ago
@davidread would you be up for a review?
Looks like much simpler code using the pycurl library and more error handling, which is v. good. However I've not tried it and this part of ckanclient which although I've looked at previously, I've failed to understand - the ins and outs of multipart form encoding seem pretty obscure.
@slmnhq wrote the original code 57e86c33b , so perhaps he can comment on this change?
+1 for pycurl or requests.
I was trying to avoid introducing a new dependency beyond httplib.
On Fri, Nov 22, 2013 at 5:20 AM, David Read notifications@github.comwrote:
Looks like much simpler code using the pycurl library and more error handling, which is v. good. However I've not tried it and this part of ckanclient which although I've looked at previously, I've failed to understand - the ins and outs of multipart form encoding seem pretty obscure.
@slmnhq https://github.com/slmnhq wrote the original code 57e86c3https://github.com/okfn/ckanclient/commit/57e86c33b, so perhaps he can comment on this change?
— Reply to this email directly or view it on GitHubhttps://github.com/okfn/ckanclient/pull/29#issuecomment-29062572 .
I initially tried to improve the existing code without any news dependency but it appeared to be difficult to do (Note: I am far from an experienced developer). As a result, pycurl seemed to be a reasonable requirement given the task at end.
No problem introducing a dep in my opinion but i'm wondering if http://www.python-requests.org/en/latest/ might not be better than pycurl as it would be pure python ...
+1 for requests
@Hoedic i know itis a bit of an ask but would you consider a switch for your patch to use requests - you'll probably like it even more :-)
Yes, I'll look at that. Let me few days because I have a rush for the moment
@Hoedic so what i'm going to suggest is we merge your PR now (its a definite improvement) and then we try to refactor to use requests - i've opened an issue for this as #31
Currently, ckanclient throws errors when trying to upload non-ascii file (mainly with latin1 encoding). This code proposes some changes to support any time of encoding as it does not "opening" the files to be uploaded. Also adds some exception management at the file upload level.