summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorKodi Arfer <git@arfer.net>2012-11-30 17:16:21 -0500
committerKodi Arfer <git@arfer.net>2012-11-30 17:28:53 -0500
commitd222f1a459181f639aad2d05b453d2599331d8aa (patch)
treeae51d5618cd618e15878838c0c42483430f66575 /bin
parent85871bab114581ce384a38af92968d58adaab781 (diff)
downloadboto-d222f1a459181f639aad2d05b453d2599331d8aa.tar.gz
[MTurk CLI] Show description and keywords for the "hit" command.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mturk11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/mturk b/bin/mturk
index 688c3d0e..aa277773 100755
--- a/bin/mturk
+++ b/bin/mturk
@@ -146,7 +146,7 @@ def get_nickname(hitid):
def display_datetime(dt):
return dt.strftime('%e %b %Y, %l:%M %P')
-def display_hit(hit):
+def display_hit(hit, verbose = False):
et = parse_timestamp(hit.Expiration)
return '\n'.join([
'{} - {} ({}, {}, {})'.format(
@@ -170,10 +170,13 @@ def display_hit(hit):
int(hit.MaxAssignments) - (int(hit.NumberOfAssignmentsAvailable) + int(hit.NumberOfAssignmentsPending) + int(hit.NumberOfAssignmentsCompleted)),
hit.NumberOfAssignmentsCompleted)
if hasattr(hit, 'NumberOfAssignmentsAvailable')
- else 'Assignments: {} total'.format(hit.MaxAssignments)
+ else 'Assignments: {} total'.format(hit.MaxAssignments),
# For some reason, SearchHITs includes the
# NumberOfAssignmentsFoobar fields but GetHIT doesn't.
- ]) + '\n'
+ ] + ([] if not verbose else [
+ '\nDescription: ' + hit.Description,
+ '\nKeywords: ' + hit.Keywords
+ ])) + '\n'
def digest_assignment(a):
return dict(
@@ -191,7 +194,7 @@ def get_balance():
return con.get_account_balance()
def show_hit(hit):
- return display_hit(con.get_hit(hit)[0])
+ return display_hit(con.get_hit(hit)[0], verbose = True)
def list_hits():
'Lists your 10 most recently created HITs, with the most recent last.'