Skip to main content

CrowdFlower API - Python client

Project description

Client library for interacting with the CrowdFlower API with Python.

Installation

Install from PyPI:

easy_install -U crowdflower

Or install the latest version GitHub:

git clone https://github.com/chbrown/crowdflower.git
cd crowdflower
python setup.py develop

Import examples

Import:

import crowdflower

CrowdFlower API keys are 20 characters long; the one below is just random characters.

conn = crowdflower.Connection('LbcxvIlE3x1M8F6TT5hN')

The library will default to an environment variable called CROWDFLOWER_API_KEY if none is specified here:

conn = crowdflower.Connection()

If you want to cache job responses, like judgments, properties, and tags, you can initialize the connection with a cache. cache='filesystem' is the only option currently supported, and serializes JSON files to /tmp/crowdflower/*.

conn = crowdflower.Connection(cache='filesystem')

More examples

Loop through all your jobs and print the titles:

for job in conn.jobs():
    print job.properties['title']

Create a new job with some new units:

data = [
    {'id': '1', 'name': 'Chris Narenz', 'gender_gold': 'male'},
    {'id': '2', 'name': 'George Henckels'},
    {'id': '3', 'name': 'Maisy Ester'},
]
job = conn.upload(data)
job.update({
    'title': 'Gender labels',
    'included_countries': ['US', 'GB'],  # Limit to the USA and United Kingdom
    'payment_cents': 5,
    'judgments_per_unit': 2,
    'instructions': <some instructions html>,
    'cml': <some layout cml>,
    'options': {
        'front_load': 1, # quiz mode = 1; turn off with 0
    }
})
job.gold_add('gender', 'gender_gold')

print job

References

This package uses kennethreitz’s Requests to communicate with the CrowdFlower API over HTTP. Requests is Apache2 licensed.

License

Copyright © 2014 Christopher Brown. MIT Licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crowdflower-0.0.9.tar.gz (9.2 kB view details)

Uploaded Source

File details

Details for the file crowdflower-0.0.9.tar.gz.

File metadata

  • Download URL: crowdflower-0.0.9.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crowdflower-0.0.9.tar.gz
Algorithm Hash digest
SHA256 1a3df5d964cd01e33a10b01102284ddf105047886da1bf7d2afd7b655c1f05a4
MD5 2f30a1b4e94f3271338f5a7192c6dd12
BLAKE2b-256 f59b398154ed391ee8b029b984d5a78d5f3c7dce367810a582f7939100bbb375

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page