[ckan-dev] CKAN API Clients

Haq, Salman Salman.Haq at neustar.biz
Mon Apr 30 18:43:49 UTC 2012



On 4/30/12 10:08 AM, "Sean Hammond" <sean.hammond at okfn.org> wrote:

>> > And this is a the new ckanclient.loader.util module:
>> > http://git.io/zYk8NA
>> > 
>> > 'upload_file' and 'add_package_resource' are two high-level utility
>> > functions it defines.
>> > 
>> > To actually upload the file, we have to perform a multi-part form
>>upload
>> > which urllib2 does not handle by default so I've used httplib for that
>> > purpose. The 'poster' module has a special urllib2 opener for doing
>> > multi-part uploads but I didn't want to introduce a new dependency.
>> > 
>> > Test cases to follow soon.
>> 
>> Sorry I didn't have time to look at this this week. I'll get back to you
>> about it next week (unless someone else can do it sooner?) but I think
>> you can go ahead and add test cases, and maybe also integrate it into
>> ckanclient/__init__.py? I think it's great work and will surely be
>> useful
>
>This code looks good to me so I'd like to merge it once it's integrated
>into ckanclient/__init__.py and maybe has some test cases. I did have
>one problem testing it locally here, line 87 of util.py is using
>u.hostname but that was None, when it should be '127.0.0.1:5000', so the
>upload was failing. I think the problem is that auth_dict['action'] on
>line 84 may be just a path like /storage/upload that does not contain
>the hostname.

Sean,

Can you tell me how to reproduce this problem as I am unable to.

There is a separate problem that I found, where the resource url can end
up having 'localhost' or '127.0.0.1' as the hostname. Such a url is
meaningless if you access the resource from a machine other than where the
CKAN server is running.

Salman



>
>_______________________________________________
>ckan-dev mailing list
>ckan-dev at lists.okfn.org
>http://lists.okfn.org/mailman/listinfo/ckan-dev





More information about the ckan-dev mailing list