Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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']
- # incomplete list of Asian country 2-letter codes
- asian_countries = [
- 'AF',
- 'BD',
- 'MM',
- 'KH',
- 'CN',
- 'GE',
- 'HK',
- #'IN', India
- 'ID',
- 'JP',
- 'KR',
- 'LA',
- 'MO',
- 'MY',
- 'MN',
- 'NP',
- #'PK', Pakistan
- 'PG',
- 'PH',
- 'RU',
- 'SG',
- #'LK', Sri Lanka
- 'TW',
- 'TJ',
- 'TH',
- 'TR',
- 'UA',
- 'VN',
- ]
- sa_countries = [
- 'AR', # Argentina
- 'BO', # Bolivia
- 'BR', # Brazil
- 'CL', # Chile
- 'CO', # Colombia
- 'EC', # Ecuador
- 'FK', # Falkland Islands
- 'GF', # French Guiana
- 'GY', # Guyana
- 'PY', # Paraguay
- 'PE', # Peru
- 'GD', # South Georgia
- 'SR', # Suriname
- 'UY', # Uruguay
- 'VE', # Venezuela
- ]
- africa_countries = [
- 'DZ', # Algeria
- 'AO', # Angola
- 'BJ', # Benin
- 'BW', # Botswana
- 'BF', # Burkina Faso
- 'BI', # Burundi
- 'CM', # Cameroon
- 'CV', # Cape Verde
- 'CF', # Central African Republic
- 'TD', # Chad
- 'KM', # Comoros
- 'CG', # Congo
- 'CI', # Ivory Coast
- 'DJ', # Djibouti
- 'EG', # Egypt
- 'GQ', # Equatorial Guinea
- 'ER', # Eritrea
- 'ET', # Ethiopia
- 'GA', # Gabon
- 'GM', # Gambia
- 'GH', # Ghana
- 'GN', # Guinea
- 'GW', # Guinea-Bissau
- 'KE', # Kenya
- 'LS', # Lesotho
- 'LR', # Liberia
- 'LY', # Libya
- 'MG', # Madagascar
- 'MW', # Malawi
- 'ML', # Mali
- 'MR', # Mauritania
- 'MU', # Mauritius
- 'MA', # Morocco
- 'MZ', # Mozambique
- 'NA', # Namibia
- 'NE', # Niger
- 'NG', # Nigeria
- 'RW', # Rwanda
- 'ST', # Sao Tome and Principe
- 'SN', # Senegal
- 'SC', # Seychelles
- 'SL', # Sierra Leone
- 'SO', # Somalia
- 'ZA', # South Africa
- 'SD', # Sudan
- 'SZ', # Swaziland
- 'TZ', # Tanzania
- 'TG', # Togo
- 'TN', # Tunisia
- 'UG', # Uganda
- 'EH', # Western Sahara
- 'ZM', # Zambia
- 'ZW', # Zimbabwe
- ]
- 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"),
- ]
- t = mw.Task(instructions=instr)
- for (label, type) in fields:
- t.add_field(label, type)
- t.set_params(location=['es'])
- t.set_params(blocked=blocked_workers)
- t.set_params(workflow='s')
- t.set_params(payment=4)
- t.set_params(redundancy=100)
- task_url = t.post()
- print task_url
Add Comment
Please, Sign In to add comment