示例#1
0
def main(args):
    use_sandbox = False if args.prod else True
    et = EasyTurk(sandbox=use_sandbox)
    online_hits = et.list_hits()

    for i, hit in enumerate(online_hits):
        #print("HIT {} of {} has title {}".format(i, len(online_hits), hit['Title']))
        if hit['Title'] == args.target_title:
            print("HIT {} should be deleted. Title={}, Description={}".format(
                hit['HITId'], hit['Title'], hit['Description']))
            if args.delete_without_ask:
                print("Deleting HIT {}".format(hit['HITId']))
                et.delete_hit(hit['HITId'])
示例#2
0
def main(args):
    use_sandbox = False if args.prod else True
    et = EasyTurk(sandbox=use_sandbox)
    hits_filename = args.json_path

    if os.path.exists(hits_filename):

        current_hits = json.load(open(hits_filename, 'r'))
        remaining_hits = []
        for hit in current_hits:
            success = et.delete_hit(hit)
            if not success: remaining_hits.append(hit)
        json.dump(remaining_hits, open(hits_filename, 'w'))
        print("Remaining hits on {}: \n{}".format(hits_filename,
                                                  remaining_hits))
    else:
        print("No hits to delete from {}".format(hits_filename))