[ckan-dev] CKAN API Clients

Toby Dacre toby.okfn at gmail.com
Wed May 2 09:46:10 UTC 2012


ckanclient still has references to packages maybe these should be updated
to dataset

eg

'Package Search': '/search/package',


On 2 May 2012 09:54, Sean Hammond <sean.hammond at okfn.org> wrote:

> >
> >
> > On 4/30/12 3:23 PM, "Rufus Pollock" <rufus.pollock at okfn.org> wrote:
> >
> > >On 30 April 2012 18:46, Haq, Salman <Salman.Haq at neustar.biz> wrote:
> > >>
> > >>
> > >> 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,
> > >>
> > >> I'll fix the issue with localhost issue that you¹ve highlight.
> > >>
> > >> Should the functions `upload_file` and `add_package_resource` become
> > >> methods of the CkanClient class while the helpers remain the `util`
> > >> module? Or do you want to not have a `util` module at all?
> > >
> > >I'd suggest adding to main class. I'm also happy to review the
> > >functions once done (this could substitute for getting you an upload
> > >example).
> >
> > Okay, I've moved all code from the util module into the CkanClient class.
> > ckanclient.loaders.util has been deleted.
> >
> > See the changeset here:
> >
> >
> https://github.com/slmnhq/ckanclient/commit/d233fcb3f73644b8b505839bedc16d3
> > 52434e946
>
> Rufus, let me know if you want me to look at this, otherwise I'll leave
> it for you to review. Thanks! And fantastic work on this Salman
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120502/ee144e4f/attachment-0001.html>


More information about the ckan-dev mailing list