Code Monkey home page Code Monkey logo

kanboard-py's Introduction

Kanboard-py

Kanboard python API client It wraps internal JSON-RPC protocol with classes and simplifies client applications creation.

Dependencies

  • json
  • requests

Tested on

  • python 2.7.9

Code samples

Create task on specified project column

import kanboard
from kanboard.task import Task

board = kanboard.Kanboard('http://localhost:8080/jsonrpc.php',
                          '347a020cb5ce709441aa42b2d5652fbb8b02e477104d1d9789f7b2d40df0')

project = board.get_project_by_name('Test')
column = project.get_column_by_name('Work in progress')
task = column.create_task('Test title', description='test descr', color=Task.COLOR_ORANGE)

Iterate over all project tasks

import kanboard
from kanboard.task import Task

board = kanboard.Kanboard('http://localhost:8080/jsonrpc.php',
                          '347a020cb5ce709441aa42b2d5652fbb8b02e477104d1d9789f7b2d40df0')

project = board.get_project_by_name('Test')
tasks = project.get_all_tasks()
for task in tasks:
    print task.title

Close all tasks in column

board = kanboard.Kanboard('http://localhost:8080/jsonrpc.php',
                          '347a020cb5ce709441aa42b2d5652fbb8b02e477104d1d9789f7b2d40df0')

project = board.get_project_by_name('Test')
column = project.get_column_by_name('Done')
tasks = column.get_tasks()
for task in tasks:
    task.close()

Show comments of red tasks in column

board = kanboard.Kanboard('http://localhost:8080/jsonrpc.php',
                          '347a020cb5ce709441aa42b2d5652fbb8b02e477104d1d9789f7b2d40df0')

project = board.get_project_by_name('Test')
column = project.get_column_by_name('Work in progress')
tasks = column.get_tasks()
for task in tasks:
    if task.color == Task.COLOR_RED:
        for comment in task.get_all_comments():
            print comment.comment

Close all tasks at 'Done' column

board = kanboard.Kanboard('http://localhost:8080/jsonrpc.php',
                          '347a020cb5ce709441aa42b2d5652fbb8b02e477104d1d9789f7b2d40df0')

project = board.get_project_by_name('Test')
column = project.get_column_by_name('Done')
tasks = column.get_tasks()
for task in tasks:
    task.close()

Update category and color of tasks

board = kanboard.Kanboard('http://localhost:8080/jsonrpc.php',
                          '347a020cb5ce709441aa42b2d5652fbb8b02e477104d1d9789f7b2d40df0')

project = board.get_project_by_name('Test')

host_category = project.get_category_by_name('host')
for task in project.get_tasks():
    task.update(category=host_category, color=Task.COLOR_BLUE)

get tasks for swimlane

test_project = board.get_project_by_name('Test')
swimlane = test_project.get_swimlane_by_name('Custom swimlane')
columns = swimlane.get_columns()
for column in columns:
    print column
    for task in column.get_tasks():
        print u'\t' + unicode(task)

create task on swimlane

test_project = board.get_project_by_name('Test')
first_swimlane = test_project.get_swimlane_by_name('First Swimlane')
first_swimlane.create_task('Sample title')

create task on swimlane and specified column

test_project = board.get_project_by_name('Test')
first_swimlane = test_project.get_swimlane_by_name('First Swimlane')
done_column = first_swimlane.get_column_by_name('Done')
done_column.create_task('test creation for swimlane')

create subtask

test_project = board.get_project_by_name('Test')
task = test_project.get_tasks()[0]
subtask = task.create_subtask('test subtask')

close all subtask

test_project = board.get_project_by_name('Test')
task = test_project.get_tasks()[0]
for subtask in task.get_all_subtasks():
    subtask.update_status(Subtask.STATUS_DONE)

add attachment to task

test_project = board.get_project_by_name('Test')
task = test_project.get_tasks()[0]
task.create_file('test.txt', False, '/tmp/test.txt')

get all attachments

test_project = board.get_project_by_name('Test')
task = test_project.get_tasks()[0]
task.get_all_files()

get attachment content

test_project = board.get_project_by_name('Test')
task = test_project.get_tasks()[0]
attachment = task.get_all_files()[0].get_content()

create new link with opposite one

board = kanboard.Kanboard('http://localhost:8080/jsonrpc.php',
                          '347a020cb5ce709441aa42b2d5652fbb8b02e477104d1d9789f7b2d40df0')
link = board.create_link('manage', 'managed by')

get link by label and show opposite link

link = board.get_link_by_label('manage')
print link.opposite()

get all links

links = board.get_all_links()

update link label

link = board.get_link_by_id(10)
link.update('prepared before')

kanboard-py's People

Contributors

freekoder avatar

Watchers

Sebastian Reimers avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.