Skip to content

Instantly share code, notes, and snippets.

@teleyinex
Created July 17, 2013 06:47
Show Gist options
  • Save teleyinex/6018186 to your computer and use it in GitHub Desktop.
Save teleyinex/6018186 to your computer and use it in GitHub Desktop.
Add tasks from a JSON file to a PyBossa server using pybossa-client
import json
import pbclient
pbclient.set('endpoint', 'http://server.com')
pbclient.set('api_key', 'YOURAPIKEY')
# Get the application ID
app = pbclient.find_app(short_name='APP_SHORT_NAME')
# Parse the JSON object
data = open('/path/to/your/json/file').read()
tasks = json.loads(data)
# NOTE: you need to know the structure of your JSON file to pass the correct information to the task_info variable.
for task in tasks:
pbclient.create_task(app.id, task_info=task)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment