[ckan-dev] Create resource with french accents
Dan Mihaila
danmihaila at gmail.com
Fri Oct 16 09:43:05 UTC 2015
Hello,
The same resources is working fine from UI, you can check it on dataset
link I provided. I only have the issue when trying to create resource via
API.
Dan
*Dan Mihaila*, IT Consultant
(M) +40 722 502 304 • (GTalk) dan.mihaila at gmail.com • (Skype) carcotelul
• (Twitter) dan_mihaila • (Yahoo) carcotelul
<dmihaila at dginternational.org>
On Fri, Oct 16, 2015 at 11:26 AM, Serban Teodorescu <
teodorescu.serban at gmail.com> wrote:
> Is it working from UI?
>
> Vin, 16 oct. 2015, 11:25, Dan Mihaila <danmihaila at gmail.com> a scris:
>
>> Hello,
>> I am trying to create a resource with filename containg french accents
>> via API. The resource is created, but the file is not uploaded. I
>> reproduced the same behaviour local and I couldn't find a solution.
>> For example, I used http://master.ckan.org/dataset/asdgadsgadsgas and
>> you can see that the resource is created:
>> http://master.ckan.org/dataset/asdgadsgadsgas/resource/4d8f2f38-07a9-479d-a557-880ace834016
>> but when trying to download I am getting a 404 error:
>> http://master.ckan.org/dataset/8da7d905-2c3f-4faa-89b1-3635a9d06e73/resource/4d8f2f38-07a9-479d-a557-880ace834016/download/testfrenchaccentseies.zip
>>
>> The script I am trying to run is a simple one:
>>
>> # coding=UTF-8
>> # -*- coding: utf-8 -*-
>> import requests
>> import os
>> url = 'http://master.ckan.org/api/3/action/resource_create'
>> api_key = '27eb9769-eef3-4267-aaf1-be7038194732'
>>
>> h_dict={'X-CKAN-API-Key': api_key}
>>
>> data_dict = {}
>> #other settings for resource
>> data_dict['name'] = u'Test_french_accents_éiés.zip'
>> data_dict['url'] = data_dict['name']
>> path = u'/mypath/Test_french_accents_éiés.zip'
>>
>> resource_file = os.path.join(path)
>> files = {'upload': open(resource_file, 'rb')}
>> r = requests.post(url, data=data_dict, headers=h_dict, files=files,
>> verify=False)
>>
>> What should I do to be able to make it work? :)
>>
>> Thanks,
>>
>> *Dan Mihaila*, IT Consultant
>> (M) +40 722 502 304 • (GTalk) dan.mihaila at gmail.com • (Skype) carcotelul
>> • (Twitter) dan_mihaila • (Yahoo) carcotelul
>> <dmihaila at dginternational.org>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20151016/7d143595/attachment-0003.html>
More information about the ckan-dev
mailing list