Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error at kanboard.Client( #36

Open
bdika opened this issue Feb 27, 2024 · 11 comments
Open

Getting error at kanboard.Client( #36

bdika opened this issue Feb 27, 2024 · 11 comments

Comments

@bdika
Copy link

bdika commented Feb 27, 2024

Can't get the following to work(adjusted for my url):

import kanboard

kb = kanboard.Client('http://localhost/jsonrpc.php', 'jsonrpc', 'your_api_token')
project_id = kb.create_project(name='My project')
task_id = kb.create_task(project_id=project_id, title='My task title')

Tried

from kanboard import client

without any luck.

Any help much appreciated.

Thanks.

Bill Dika

@AloisMahdal
Copy link
Contributor

What error are you getting?

Are you sure kanboard is running at localhost:80 and the user & API token are both correct?

@AloisMahdal
Copy link
Contributor

AloisMahdal commented Feb 27, 2024

By the way, I actually use the API like this:

kc = kanboard.Client(...)
kc.execute(
    method='createTask',
    project_id=1,
    title="hello",
    description="world",
)

and learn method names and arguments from the API documentation, eg. this page for createTask: https://docs.kanboard.org/v1/api/task_procedures/#createtask

@bdika
Copy link
Author

bdika commented Feb 27, 2024 via email

@AloisMahdal
Copy link
Contributor

It can be any host:port as long as it matches the URL.

Apparently you have syntax error in your newtask.py script, that has nothing to do with kanboard.

The syntax error was not in either of the snippets you have provided.

@bdika
Copy link
Author

bdika commented Feb 28, 2024 via email

@bdika
Copy link
Author

bdika commented Feb 28, 2024 via email

@AloisMahdal
Copy link
Contributor

You need to call the Client.execute() method as I have shown above: with the method name as single positional parameter, and the method-specific arguments as keyword arguments, not as a sinlge dictionary.

kc.execute('getAllTasks', project_id=2, status_id=1)

If you have the method-specific arguments already collected in a dictionary, you can use ** Python syntax to convert them into keyword arguments:

my_params = {'project_id': 2, 'status_id': 1})
kc.execute('getAllTasks', **my_params)

@AloisMahdal
Copy link
Contributor

Regarding your backup strategy, while it's technically possible to use API to collect relevant data to a file, I would not go that way if the goal was simply to back up the contents.

I would look for recommendation in Kanboard docs, but the best method will depend on how you have Kanboard deployed. For example, I use quay.io/kanboard/kanboard container, with a write-enabled directory mounted where Kanboard is storing its files including config, db.sqlite and attachments. Simply backing up the directory using borg backup is enough in my case. (Shutting down the container before the backup and bringing it back afterwards would be preferable; I take the risk of not doing so in my case.)

As I said, by collecting the data using the API you would have to collect not just tasks but also other things like users, swimlanes, columns, projects, comments and much more. Also you would have to figure out how to store the data for later. And eventually it could turn out that not all could be restored 100% using API.

It's just not the right tool for the job.

@bdika
Copy link
Author

bdika commented Mar 6, 2024 via email

@AloisMahdal
Copy link
Contributor

No worries, I hope you will (or have) find out how to solve your issue.

I'm not familiar with TrueNAS, but since it looks to be open solution, I'd guess there indeed is a way to get access to the SQL instance more directly, eg. via SSH. You just probably need to dig a little bit deeper.

If you are still stuck, you could try talking to truenas community. For example, I see they have a relatively active IRC channel #truenas on Libera IRC and there might be other platforms as well.

Anyway, since there does not seem to be any confirmed issue with kanboard itself, please consider closing this issue.

@bdika
Copy link
Author

bdika commented Apr 5, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants