Guest User

Untitled

a guest
Dec 8th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import getpass
  4. import os
  5. import sys
  6. import mobileworks as mw
  7.  
  8. blocked_workers = ['138-897-73105', '5454-4963-404484', '3083-2592-211248']
  9.  
  10. # incomplete list of Asian country 2-letter codes
  11. asian_countries = [
  12. 'AF',
  13. 'BD',
  14. 'MM',
  15. 'KH',
  16. 'CN',
  17. 'GE',
  18. 'HK',
  19. #'IN', India
  20. 'ID',
  21. 'JP',
  22. 'KR',
  23. 'LA',
  24. 'MO',
  25. 'MY',
  26. 'MN',
  27. 'NP',
  28. #'PK', Pakistan
  29. 'PG',
  30. 'PH',
  31. 'RU',
  32. 'SG',
  33. #'LK', Sri Lanka
  34. 'TW',
  35. 'TJ',
  36. 'TH',
  37. 'TR',
  38. 'UA',
  39. 'VN',
  40. ]
  41.  
  42. sa_countries = [
  43. 'AR', # Argentina
  44. 'BO', # Bolivia
  45. 'BR', # Brazil
  46. 'CL', # Chile
  47. 'CO', # Colombia
  48. 'EC', # Ecuador
  49. 'FK', # Falkland Islands
  50. 'GF', # French Guiana
  51. 'GY', # Guyana
  52. 'PY', # Paraguay
  53. 'PE', # Peru
  54. 'GD', # South Georgia
  55. 'SR', # Suriname
  56. 'UY', # Uruguay
  57. 'VE', # Venezuela
  58. ]
  59.  
  60. africa_countries = [
  61. 'DZ', # Algeria
  62. 'AO', # Angola
  63. 'BJ', # Benin
  64. 'BW', # Botswana
  65. 'BF', # Burkina Faso
  66. 'BI', # Burundi
  67. 'CM', # Cameroon
  68. 'CV', # Cape Verde
  69. 'CF', # Central African Republic
  70. 'TD', # Chad
  71. 'KM', # Comoros
  72. 'CG', # Congo
  73. 'CI', # Ivory Coast
  74. 'DJ', # Djibouti
  75. 'EG', # Egypt
  76. 'GQ', # Equatorial Guinea
  77. 'ER', # Eritrea
  78. 'ET', # Ethiopia
  79. 'GA', # Gabon
  80. 'GM', # Gambia
  81. 'GH', # Ghana
  82. 'GN', # Guinea
  83. 'GW', # Guinea-Bissau
  84. 'KE', # Kenya
  85. 'LS', # Lesotho
  86. 'LR', # Liberia
  87. 'LY', # Libya
  88. 'MG', # Madagascar
  89. 'MW', # Malawi
  90. 'ML', # Mali
  91. 'MR', # Mauritania
  92. 'MU', # Mauritius
  93. 'MA', # Morocco
  94. 'MZ', # Mozambique
  95. 'NA', # Namibia
  96. 'NE', # Niger
  97. 'NG', # Nigeria
  98. 'RW', # Rwanda
  99. 'ST', # Sao Tome and Principe
  100. 'SN', # Senegal
  101. 'SC', # Seychelles
  102. 'SL', # Sierra Leone
  103. 'SO', # Somalia
  104. 'ZA', # South Africa
  105. 'SD', # Sudan
  106. 'SZ', # Swaziland
  107. 'TZ', # Tanzania
  108. 'TG', # Togo
  109. 'TN', # Tunisia
  110. 'UG', # Uganda
  111. 'EH', # Western Sahara
  112. 'ZM', # Zambia
  113. 'ZW', # Zimbabwe
  114. ]
  115.  
  116. mw.username = 'mdrcode'
  117.  
  118. if "MWPASS" in os.environ:
  119. mw.password = os.environ["MWPASS"]
  120. else:
  121. mw.password = getpass.getpass("MobileWorks password? ")
  122.  
  123. mw.sandbox()
  124.  
  125. if len(sys.argv) > 1 and sys.argv[1] == "prod":
  126. mw.production()
  127.  
  128. instr = """
  129. Please enter basic information about yourself, your location, and the local
  130. store where you shop.
  131. """
  132.  
  133. fields = [
  134. ("Your First Name", "t"),
  135. ("Your City", "t"),
  136. ("Your Country", "t"),
  137. ("Name of your local store (market, grocery, etc)", "t"),
  138. ]
  139.  
  140. t = mw.Task(instructions=instr)
  141.  
  142. for (label, type) in fields:
  143. t.add_field(label, type)
  144.  
  145. t.set_params(location=['es'])
  146.  
  147. t.set_params(blocked=blocked_workers)
  148. t.set_params(workflow='s')
  149. t.set_params(payment=4)
  150. t.set_params(redundancy=100)
  151.  
  152. task_url = t.post()
  153.  
  154. print task_url
Add Comment
Please, Sign In to add comment