Created
August 21, 2012 00:46
-
-
Save mdrcode/3410057 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
import getpass | |
import os | |
import sys | |
import mobileworks as mw | |
# incomplete list of Asian country 2-letter codes | |
asian_countries = ['AF', 'BD', 'MM', 'KH', 'CN', 'GE', 'HK', | |
'IN', 'ID', 'JP', 'KR', 'LA', 'MO', 'MY', | |
'MN', 'NP', 'PK', 'PG', 'PH', 'RU', 'SG', | |
'LK', 'TW', 'TJ', 'TH', 'TR', 'UA', 'VN'] | |
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 the local | |
store where you shop. | |
""" | |
fields = [ | |
("Your First Name", "t"), | |
("Your City", "t"), | |
("Your Country", "t"), | |
("Name of your local store (market, grocery, etc)", "t"), | |
] | |
proj = mw.Project(instructions=instr) | |
proj.set_params(workflow='s') | |
proj.set_params(payment=3) | |
proj.set_params(redundancy=10) | |
proj.set_params(location=asian_countries) | |
proj.add_task(mw.Task()) | |
for (label, type) in fields: | |
proj.add_field(label, type) | |
proj_url = proj.post() | |
print proj_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment