#-*- coding: utf-8 -*-
__author__ = 'LILI'
import requests
import json
import pprint
CKAN_URL = 'http://default.yourckan.com'
APIkey = 'API Key'
OwnerOrg = 'Organization'
PackageName = 'test'
PackageTitle = 'test'
def create_package(APIkey, OwnerOrg, PackageName,PackageTitle):
url = '{ckan}/api/3/action/package_create'.format(
ckan=CKAN_URL)
headers = {}
headers['Content-Type'] = 'application/json'
headers['X-CKAN-API-Key'] = APIkey
headers['Authorization'] = APIkey
headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0'
dict = {}
dict['name'] = PackageName
dict['title'] = PackageTitle
dict['owner_org'] = OwnerOrg
dict = json.dumps(dict).encode('ascii')
r = re
Python使用Ckan API创建CKAN的package
最新推荐文章于 2023-06-08 15:26:25 发布