-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uploading a file from url #102
Comments
That's not a file, it's a url. Try urlopen() instead. |
(or just set the url on the resource instead of uploading the file if that's what you prefer) |
Thanks Wardi, i tried the urllib2.urlopen(file), this works fine but the problem here is that its not getting the filename so CKAN cant view the resource. |
You can set a file name explicitly by passing a tuple, e.g. |
(without linkage to the file) |
your code looks wrong.
filename is where you put your file's name |
Thanks wardi, i got it working now. |
I get errors trying to upload file into CKAN using resource_create from URL with the below
from ckanapi import RemoteCKAN
ua = 'ckanapiexample/1.0 (+http://example.com/my/website)'
fileurl = "http://goog.com/go/file.csv"
mysite = RemoteCKAN('http://myckan.example.com', apikey='real-key', user_agent=ua)
mysite.action.resource_create(
package_id='my-dataset-with-files',
url='dummy-value', # ignored but required by CKAN<=2.5.x
upload=open(fileurl, 'rb'))
The text was updated successfully, but these errors were encountered: