okfn / ckanclient-deprecated

DEPRECATED - please see https://github.com/ckan/ckanapi. [Python client library for CKAN]
http://pypi.python.org/pypi/ckanclient
25 stars 17 forks source link

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

Open ravidziv opened 11 years ago

ravidziv commented 11 years ago

0 down vote favorite

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 the API)

import ckanclient

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

What am I doing wrong?

rossjones commented 10 years ago

Have you tried (in the CkanClient constructor) to set base_location to 'http://datahub.io/api' ?