Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用ckanapi(Python)将文件上载到CKAN_Python_Api_Ckan - Fatal编程技术网

使用ckanapi(Python)将文件上载到CKAN

使用ckanapi(Python)将文件上载到CKAN,python,api,ckan,Python,Api,Ckan,它失败于: 字段错误:{u'url':[u'Missing value'],u''类型:u'Validation Error'} 他们在GitHub上的讨论中将url作为必需属性: 那么url属性的预期值是多少? 如果它需要指向本地文件的url,则不会承载该文件。 我无法在CKAN上提供文件的url,因为resourceid尚未创建 PS:当为url属性传递任意值时,上载成功。 要求url属性没有任何意义。有人能解释吗?在我看来,这是CKAN中的一个bug。我已经创建了一个问题来跟踪它。我也在

它失败于:

字段错误:{u'url':[u'Missing value'],u''类型:u'Validation Error'}

他们在GitHub上的讨论中将url作为必需属性:

那么url属性的预期值是多少? 如果它需要指向本地文件的url,则不会承载该文件。 我无法在CKAN上提供文件的url,因为resourceid尚未创建

PS:当为url属性传递任意值时,上载成功。
要求url属性没有任何意义。有人能解释吗?

在我看来,这是CKAN中的一个bug。我已经创建了一个问题来跟踪它。我也在ckanapi上写了一个pull请求来抽象这个bug

同时,作为一种解决方法,您可以将
url
设置为空字符串

import ckanapi

try:

        ckan = ckanapi.RemoteCKAN(serverurl,
            apikey='myapikeyhere',
            user_agent='useragenthere')

    res = ckan.action.resource_create(
        package_id='2ad3c9de-502c-403a-8b03-bfc619697ff2',
        #url='url',
        #revision_id='revid',
        description='my first upload with CKANAPI',
        upload=open('./upload.csv')
    )

except Exception as e:
        raise Exception(str(e.error_dict))