Welcome to pybossa-client’s documentation!

This small library will help you to create and manage your applications in a PyBossa server.

Install

You can install pybossa-client using pip, preferably while working in a virtualenv:

$ pip install pybossa-client

Usage

Setup:

import pbclient

# setup the server connection
pbclient.set('endpoint', 'http://pybossa.com')
pbclient.set('api_key', '--your-api-key-here--')

Create an application:

pbclient.create_app('Name of the App', 'shortname', 'Description')

Change the long description of an app:

app = pbclient.find_app(short_name='flickrperson')
app.long_description = open('longdesc.html').read()

pbclient.update_app(app)

Create a new task:

task_info = {
    'image': 'http://farm9.staticflickr.com/8146/7566819662_f2c74e77d8_m.jpg'
}
pbclient.create_task(app_id, task_info)

Module overview

Dead simple pybossa client

A simple PyBossa client

license:MIT
pbclient.create_app(name, short_name, description)

Creates an application

Parameters:
  • name (string) – PyBossa Application Name
  • short_name (string) – PyBossa Application short name or slug
  • description – PyBossa Application description
Returns:

True – the response status code

pbclient.create_task(app_id, info)

Creates a task for a given application ID

Parameters:
  • app_id (integer) – PyBossa Application ID
  • info (dict) – PyBossa Application info JSON field
Returns:

True – the response status code

pbclient.delete_app(app_id)

Deletes an Application with id = app_id

Parameters:app_id (integer) – PyBossa Application ID
Returns:True – the response status code
pbclient.delete_task(task)

Deletes a task for a given task ID

Parameters:task – PyBossa task
pbclient.find_app(**kwargs)

Returns a list with matching app arguments

Parameters:kwargs – PyBossa Application members
Return type:list
Returns:A list of application that match the kwargs
pbclient.find_taskruns(app_id, **kwargs)

Returns a list of matched task runs for a given application ID

Parameters:
  • app_id (integer) – PyBossa Application ID
  • kwargs – PyBossa Task Run members
Return type:

list

Returns:

A List of task runs that match the query members

pbclient.find_tasks(app_id, **kwargs)

Returns a list of matched tasks for a given application ID

Parameters:
  • app_id (integer) – PyBossa Application ID
  • kwargs – PyBossa Task members
Return type:

list

Returns:

A list of tasks that match the kwargs

pbclient.get_app(app_id)

Returns a PyBossa Application for the app_id

Parameters:app_id (integer) – PyBossa Application ID
Return type:PyBossa Application
Returns:A PyBossa Application object
pbclient.get_apps(limit=100, offset=0)

Returns a list of registered apps

Parameters:
  • limit (integer) – Number of returned items, default 100
  • offset (integer) – Offset for the query, default 0
Return type:

list

Returns:

A list of PyBossa Applications

pbclient.get_taskruns(app_id, limit=100, offset=0)

Returns a list of task runs for a given application ID

Parameters:
  • app_id (integer) – PyBossa Application ID
  • limit (integer) – Number of returned items, default 100
  • offset (integer) – Offset for the query, default 0
Return type:

list

Returns:

A list of task runs for the given application ID

pbclient.get_tasks(app_id, limit=100, offset=0)

Returns a list of tasks for a given application ID

Parameters:
  • app_id (integer) – PyBossa Application ID
  • limit (integer) – Number of returned items, default 100
  • offset (integer) – Offset for the query, default 0
Returns:

True – the response status code

pbclient.update_app(app)

Updates an application app instance

Parameters:app (PyBossa Application) – PyBossa Application
Returns:True – the response status code
pbclient.update_task(task)

Updates a task for a given task ID

Parameters:task – PyBossa task

Indices and tables

Table Of Contents

This Page