-
Create a new project in toloka, copying content
toloka_inner/project_html
into html section, andtoloka_inner/project.js
to js section of a new project. -
Create two fields - one input field called
session_url
, one output field calledotree_code
: -
Add JQuery and bootstrap to your project dependencies:
NB: Adding JS is crucial, because it let otree know the assignment id, generated by Toloka and that is the way we later process the payments, accept/reject the assignments etc.
-
Set environmental variables listed in
env_example
file, or put them into.env
file (remember, **do not share.env
file on github or anywhere else, because that would expose your api keys) -
add
requests
and optionally (if you use .env file)django-dotenv
torequirements_base.txt
. -
Add two variables to your session config:
toloka
andtoloka_sandbox
:dict( name='example', num_demo_participants=1, app_sequence=['example', 'last'], toloka=True, toloka_sandbox=True ),
-
Add following lines to
settings.py
:INSTALLED_APPS = ['otree' ] EXTENSION_APPS = ['tolokaregister'] TOLOKA_API = environ.get('TOLOKA_API') SANDBOX_TOLOKA_API = environ.get('SANDBOX_TOLOKA_API')
-
You are good to go. As soon as you start your session with
toloka = True
, it will be recognized bytolokaregister
as a potential toloka session, and it will list it in a data section. If you run session in Toloka sandbox, settoloka_sandbox
toTrue
, otherwise set it toFalse
.
You can check/update the status, check if the code they provided at the end of the study is correct, accept the assignment and pay the bonus
THE BONUS IS PAID IN USD. SO IF YOU USE ANOTHER CURRENCY THIS CODE WILL NOT DO ANY CURRENCY CONVERSION. THAT MEANS THAT IF THEIR PAYOFF IS 100 RUBLES, AND YOU PAY THEM IT VIA THIS INTERFACE, THEY WILL GET $100.