Comments (11)
My question is this: why are the tests passing for python 3?
from ckanapi.
@fccoelho good catch! Care to submit a PR?
from ckanapi.
Don't forget to handle encoding:
Traceback (most recent call last):
File "/Users/jasonkraus/anaconda/bin/ckanapi", line 11, in <module>
sys.exit(main())
File "/Users/jasonkraus/anaconda/lib/python3.5/site-packages/ckanapi/cli/main.py", line 110, in main
sys.stdout.write(r)
TypeError: write() argument must be str, not bytes
from ckanapi.
The python 3 tests cover use of ckanapi as a library. For the CLI I assumed it would run under python 2 (thinking it shouldn't matter to people just running a command), but if you don't have python 2 then you'll have a problem.
from ckanapi.
One problem with running the ckanapi CLI under python 3 is that it won't work for local CKAN commands (commands run on the same server without using HTTP) because CKAN itself doesn't run on Python 3 yet.
from ckanapi.
Sure, I'll make a PR soon. fixing these two things.
from ckanapi.
The PR submitted by @fccoelho has fixes for this and one other problem. #96
The other solution to the other problem started some discussion which has stalled so the PR hasn't AFAICS been accepted yet.
Could we either (a) conclude that discussion, or (b) have a PR for a fix for this specific bug? I'll submit one if that's useful
from ckanapi.
@rwillmer thanks for the reminder, I've replied on #96
from ckanapi.
hello,
i faced similar kind of issue even with python2.7 as well. I am a newbie to python and need some help understanding ckanapi
varun@varun-X756UXK:~$ sudo -H pip install ckanapi
Collecting ckanapi
Requirement already satisfied: docopt in /usr/lib/python2.7/dist-packages (from ckanapi) (0.6.2)
Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages (from ckanapi) (2.18.4)
Requirement already satisfied: simplejson in /usr/local/lib/python2.7/dist-packages (from ckanapi) (3.15.0)
Requirement already satisfied: setuptools in /usr/lib/python2.7/dist-packages (from ckanapi) (39.0.1)
Installing collected packages: ckanapi
Successfully installed ckanapi-4.1
varun@varun-X756UXK:~$ sudo ckanapi action group_list -r http://demo.ckan.org
Traceback (most recent call last):
File "/usr/local/bin/ckanapi", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/ckanapi/cli/main.py", line 110, in main
for r in action(ckan, arguments):
File "/usr/local/lib/python2.7/dist-packages/ckanapi/cli/action.py", line 53, in action
files=file_args)
File "/usr/local/lib/python2.7/dist-packages/ckanapi/remoteckan.py", line 87, in call_action
return reverse_apicontroller_action(url, status, response)
File "/usr/local/lib/python2.7/dist-packages/ckanapi/common.py", line 131, in reverse_apicontroller_action
raise CKANAPIError(repr([url, status, response]))
ckanapi.errors.CKANAPIError: ['http://demo.ckan.org/api/action/group_list', 302, u'Found']
did i do anything wrong anywhere?
from ckanapi.
@varunmaitreya this is an unrelated error. Use http*s*://demo.ckan.org
. ckanapi isn't following the 302 redirect from http
to https
(and it shouldn't, never automatically accept redirects from http to https)
from ckanapi.
@TkTech thank you 👍 now it works. It's a pity that i did miss that small thing.
from ckanapi.
Related Issues (20)
- URL already in use, but cannot update
- Enhancement: Use CKAN_INI env variable like CKAN cli command HOT 1
- Provide example of how to use the new package_revise HOT 5
- Add expanded note/examples on ckanapi's ability to work with plugins that extend the CKAN Action API HOT 1
- Bug: Error message processing fails with package_revise HOT 7
- ckanapi dump dataset --all -D $PWD fails HOT 4
- Cannot run on Python 3.10 HOT 1
- Web Scaping in Python for Large data set from CKANAPI HOT 2
- setup.py version is 4.5, but the latest release is 4.6 HOT 1
- how to download resources via search HOT 2
- dataset dump does not have attachments HOT 1
- next release HOT 2
- dataset search: query with white space
- Where can i find the documentation on fq query parameters like res_url, res_name, ecc.? HOT 1
- Ckanapi hanging after load command HOT 5
- ssl error
- ckanapi error on html.entities
- Error handling problems
- Resource uploads fail on LocalCKAN HOT 1
- datastore_create can't upload a json records file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ckanapi.