ckan / ckanapi

A command line interface and Python module for accessing the CKAN Action API
Other
176 stars 74 forks source link

Add Option to Disable Certificate Verification at Command Line #144

Closed nicholsn closed 4 years ago

nicholsn commented 4 years ago

This PR addresses an issue in the CLI where ssl certificates cannot be verified by the requests library and raises an sslError: raise SSLError(e, request=request)

This general issue is addressed in #51 where @wardi points out that you can bypass this error using:

https://github.com/ckan/ckanapi/blob/master/ckanapi/remoteckan.py#L53 with requests_kwargs={'verify': False}

Here I've added the --no-verify option to the ckanapi action command line interface which will allow users to work around this issue. Obviously, user be warned not to trust passing their API key around like this =)

Here is an example:

ckanapi action -r https://catalog.data.gov package_show id=demographic-statistics-by-zip-code-acfc9 --no-verify

Let me know if this works or if there is a better approach!

camfindlay commented 4 years ago

Hi @nicholsn I'm interested in this feature... I've installed your fork but cant get it to run the CLI command with the --no-verify flag set. Am I missing something obvious?

camfindlay commented 4 years ago

Strike that, got it to work. Feedback would be in add that --no-verify flag to the other commands eg load, dump, delete etc

nicholsn commented 4 years ago

Just pushed the update to use --insecure

@camfindlay and @wardi I started looking into adding this flag to the other commands. It looks like these are all based on call_actionso I'll see if this is a straight forward addition or not

nicholsn commented 4 years ago

@wardi this should be good to go now

nicholsn commented 4 years ago

@wardi let me know if you'd like me to add anything else

wardi commented 4 years ago

Thank you @nicholsn !