Skip to content

Instantly share code, notes, and snippets.

@mdrcode
Created August 27, 2012 17:54
Show Gist options
  • Save mdrcode/3490831 to your computer and use it in GitHub Desktop.
Save mdrcode/3490831 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import getpass
import os
import sys
import mobileworks as mw
blocked_workers = ['138-897-73105', '5454-4963-404484', '3083-2592-211248']
mw.username = 'mdrcode'
if "MWPASS" in os.environ:
mw.password = os.environ["MWPASS"]
else:
mw.password = getpass.getpass("MobileWorks password? ")
mw.sandbox()
if len(sys.argv) > 1 and sys.argv[1] == "prod":
mw.production()
instr = """
Please enter basic information about yourself, your location, and your mobile
phone.
"""
fields = [
("Your First Name", "t"),
("Your City", "t"),
("Your Country", "t"),
("Your mobile phone? (iPhone, Android, Nokia, etc)", "t"),
("Do you have access to mobile data?", "t"),
]
t = mw.Task(instructions=instr)
for (label, type) in fields:
t.add_field(label, type)
t.set_params(location=['ID'])
t.set_params(blocked=blocked_workers)
t.set_params(workflow='s')
t.set_params(payment=5)
t.set_params(redundancy=100)
task_url = t.post()
print task_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment