Ravid Ziv
Ravid Ziv

Reputation: 161

Redirected to another URL error when trying to upload file using ckanclient

I am trying to upload a json file to my acount in Datahub.io with ckanclient, and I got this error:

ckanclient.CkanApiError: Got redirected to another URL, which does not work with POSTS. Redirection: http://thedatahub.org/api/storage/auth/form/2013-07-26T022918/my.json -> http://datahub.io/user/login?came_from=http://datahub.io/api/storage/auth/form/2013-07-26T022918/my.json

The code I use is this (This is the same code as in their API)

import ckanclient 

ckan = ckanclient.CkanClient(api_key='8a482c44-ef3d-4337-88c6-dca16fd6b3f3',)
ckan.upload_file('my.json')  

What am I doing wrong?

Upvotes: 0

Views: 203

Answers (1)

Rufus Pollock
Rufus Pollock

Reputation: 2335

It looks like you are getting an access denied which is leading to a redirect to the login page:

.../user/login?came_from=http://datahub.io/api/storage/auth/form/2013-07-26T022918/my.json
         ^^^^^^^^^^^^^^^^

Not sure why that is happening - try visiting the relevant urls in your browser (whilst logged in obviously). Once that works you know it is something with the api key (and I hope that is not your real API Key you've pasted here ;-) ...)

Upvotes: 2

Related Questions