https://github.com/ctrlcctrlv/mturk-python
Complete Mechanical Turk API written in Python that uses the same names as the official documentation
https://github.com/ctrlcctrlv/mturk-python
Last synced: about 1 year ago
JSON representation
Complete Mechanical Turk API written in Python that uses the same names as the official documentation
- Host: GitHub
- URL: https://github.com/ctrlcctrlv/mturk-python
- Owner: ctrlcctrlv
- License: other
- Created: 2014-02-27T23:37:51.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-03-10T02:34:17.000Z (about 9 years ago)
- Last Synced: 2024-10-12T06:23:59.862Z (over 1 year ago)
- Language: Python
- Size: 15.6 KB
- Stars: 46
- Watchers: 6
- Forks: 18
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mturk-python
============
Complete Mechanical Turk API written in Python that uses the same names as the official documentation
mturk.py is a small library that sends requests to Mechanical Turk. It is much simpler than other libraries which redefine every function that Mechanical Turk recognizes. This saves you time so you don't have to worry about the library, just the Mechanical Turk API.
Read the official mTurk API docs [here](http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/Welcome.html).
**Installation**
The library is compatible with both Python 2 and Python 3. You can install it using pip:
pip install git+https://github.com/ctrlcctrlv/mturk-python.git
**Configuration**
The configuration settings can be passed as a dict to the `MechanicalTurk` constructor or saved in `mturkconfig.json` in the current working directory.
If you want to use a different name (or path), you can also specify that for the constructor: `mturk.MechanicalTurk(config_file='different_config_name.json')`
`stdout_log` enables the requests log of each request made to mTurk. `verify_mturk_ssl` verifies mTurk's SSL certificate. This should be left `true` in most cases, but according to bug reports it's broken on some operating systems.
```json
{
"use_sandbox" : false,
"stdout_log" : false,
"verify_mturk_ssl" : true,
"aws_key" : "ACCESSID",
"aws_secret_key" : "PASSWORD"
}
```
**Getting your balance**
```python
import mturk
m = mturk.MechanicalTurk()
r = m.request("GetAccountBalance")
if r.valid:
print r.get_response_element("AvailableBalance")
```
**Assigning a qualification**
```python
import mturk
m = mturk.MechanicalTurk()
workers = ["A1ZZZ","A1QQQ"] # Replace these, of course!
for worker in workers:
m.request("AssignQualification",
{"QualificationTypeId":"2MYQUALIFICATION",
"WorkerId":worker, "IntegerValue":100})
```
If you find any bugs please open a new issue.