ckanapi | command line interface and Python module | REST library
kandi X-RAY | ckanapi Summary
kandi X-RAY | ckanapi Summary
A command line interface and Python module for accessing the CKAN Action API. tested under Python 2.7, 3.6 and pypy.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Calls a CKAN API action
- Create a temporary file from f
- Close the session
- Calls remote CKAN API
- Reverse API response
- Prepare an action
- Wrapper around requests post
- Ckan API
- Main entry point
- Execute a ckan action
- Computes the compact JSON representation of r
ckanapi Key Features
ckanapi Examples and Code Snippets
Community Discussions
Trending Discussions on ckanapi
QUESTION
My simple python script to create a dataset and to that dataset add a single PDF file as a resource is failing with "{file} is not json serializable".
...ANSWER
Answered 2020-Sep-25 at 17:09I copied your code and ran a modified version against a local dev copy of CKAN and had it work without issue AFTER my mods which are included below.
Most notably:
- payload_r -> All that extra stuff isn't needed but you can include other resource metadata such as description, name, etc if desired just
- req_r -> 1) pass the payload here as
data
instead ofjson
as it'smultipart-form-data
. 2) send the file here with thefiles
param.
Docs: https://docs.ckan.org/en/2.9/maintaining/filestore.html#filestore-api
IMO this is less of a CKAN issue and more of an understanding of the library chosen (i.e. requests). there are many ways to do this with different tools.
I also had to update the payloads to align with my schema but assuming that's correct for yours this should work.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ckanapi
You can use ckanapi like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page