Created
July 17, 2013 06:47
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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