The CKAN client Python package.
Project description
The CKAN client software may be used to make requests on the Comprehensive
Knowledge Archive Network (CKAN) REST API.
## Synopsis ##
The simplest way to make CKAN requests is:
import ckanclient
# Instantiate the CKAN client.
ckan = ckanclient.CkanClient(api_key=my_key)
# Get the package list.
ckan.package_register_get()
package_list = ckan.last_message
print package_list
# Get the tag list.
ckan.tag_register_get()
tag_list = ckan.last_message
print tag_list
# Collect the package metadata.
package_entity = {
'name': my_package_name,
'url': my_package_url,
'download_url': my_package_download_url,
'tags': my_package_keywords,
'notes': my_package_long_description,
}
# Register the package.
ckan.package_register_post(package_entity)
# Get the details of a package.
ckan.package_entity_get(package_name)
package_entity = ckan.last_message
print package_entity
# Update the details of a package.
ckan.package_entity_get(package_name)
package_entity = ckan.last_message
package_entity['url'] = new_package_url
package_entity['notes'] = new_package_notes
ckan.package_entity_post(package_entity)
Knowledge Archive Network (CKAN) REST API.
## Synopsis ##
The simplest way to make CKAN requests is:
import ckanclient
# Instantiate the CKAN client.
ckan = ckanclient.CkanClient(api_key=my_key)
# Get the package list.
ckan.package_register_get()
package_list = ckan.last_message
print package_list
# Get the tag list.
ckan.tag_register_get()
tag_list = ckan.last_message
print tag_list
# Collect the package metadata.
package_entity = {
'name': my_package_name,
'url': my_package_url,
'download_url': my_package_download_url,
'tags': my_package_keywords,
'notes': my_package_long_description,
}
# Register the package.
ckan.package_register_post(package_entity)
# Get the details of a package.
ckan.package_entity_get(package_name)
package_entity = ckan.last_message
print package_entity
# Update the details of a package.
ckan.package_entity_get(package_name)
package_entity = ckan.last_message
package_entity['url'] = new_package_url
package_entity['notes'] = new_package_notes
ckan.package_entity_post(package_entity)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ckanclient-0.1.tar.gz
(3.6 kB
view hashes)
Built Distribution
ckanclient-0.1-py2.5.egg
(8.5 kB
view hashes)