[ckan-dev] Datastore & filestore via API

Michele Barbera barbera at spaziodati.eu
Wed Aug 8 14:07:43 UTC 2012


This is the logged error when I try to post a file to the filestore with
ckan.add_package_resource
(it creates the resource and its metadata, but the file isn't loaded
anywhere):

2012-08-08 15:52:35,186 DEBUG [pylons.controllers.core] Looking for
u'upload_handle' method to handle the request
2012-08-08 15:52:35,187 DEBUG [pylons.controllers.core] Calling
'upload_handle' method with keyword args: **{}
2012-08-08 15:52:35,194 DEBUG [pylons.controllers.util] Aborting request,
status: 401, detail: '', headers: None, comment: None
2012-08-08 15:52:35,194 DEBUG [pylons.controllers.core] 'upload_handle'
method raised HTTPException: HTTPUnauthorized (code: 401)
Traceback (most recent call last):
  File
"/home/ckan/pyenv/local/lib/python2.7/site-packages/pylons/controllers/core.py",
line 107, in _inspect_call
    result = self._perform_call(func, args)
  File
"/home/ckan/pyenv/local/lib/python2.7/site-packages/pylons/controllers/core.py",
line 60, in _perform_call
    return func(**args)
  File "/home/ckan/pyenv/src/ckan/ckan/controllers/storage.py", line 133,
in upload_handle
    authorize('POST', BUCKET, label, c.userobj, self.ofs)
  File "/home/ckan/pyenv/src/ckan/ckan/controllers/storage.py", line 99, in
authorize
    abort(401)
  File "/home/ckan/pyenv/src/ckan/ckan/lib/base.py", line 48, in abort
    comment=comment)
  File
"/home/ckan/pyenv/local/lib/python2.7/site-packages/pylons/controllers/util.py",
line 196, in abort
    raise exc.exception
HTTPUnauthorized: This server could not verify that you are authorized to
access the document you requested. Either you supplied the wrong
credentials (e.g., bad password), or your browser does not understand how
to supply the credentials required.

Any hint?

thanks,
michele



2012/8/8 Michele Barbera <barbera at spaziodati.eu>

> Hi,
> I'm using 1.7.1
>
> here's my code:
>
> 1 ckan = ckanclient.CkanClient(
> 2        base_location = CKAN_HOST + '/api',
> 3        api_key = CKAN_API_KEY
> 4    )
> 5    r = ckan.upload_file(zip_file)
> 6    print 'Upload response:', r
> 7    r = ckan.add_package_resource(dataset_name, zip_file, name=resource +
> '.zip', resource_type='metadata', format='zip')
> 8    print 'Add package response:', r
>
> at 6 I get ('', 'Found') and nothing seems to happen on the server
> (neither in the ckan_storage dir nor in the ckan logs).
>
> Thanks,
> michele
>
>
> 2012/8/8 Sean Hammond <sean.hammond at okfn.org>
>
>> Hi, which version of CKAN are you using? I'll test file uploading with
>> ckanclient here and see if it works for me
>>
>> ______________________________**_________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/**listinfo/ckan-dev<http://lists.okfn.org/mailman/listinfo/ckan-dev>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120808/0743aa79/attachment-0001.html>


More information about the ckan-dev mailing list