PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/scripts/api/sample_update_state.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 22 lines | 18 code | 3 blank | 1 comment | 0 complexity | b37b2a9095be86cd7f056b8c25129bfb MD5 | raw file
 1#!/usr/bin/env python
 2
 3
 4import os, sys, traceback
 5sys.path.insert( 0, os.path.dirname( __file__ ) )
 6from common import display
 7from common import submit
 8from common import update
 9
10try:
11    data = {}
12    data[ 'update_type' ] = 'sample_state'
13    data[ 'new_state' ] = sys.argv[3]
14except IndexError:
15    print 'usage: %s key url new_state [comment]' % os.path.basename( sys.argv[0] )
16    sys.exit( 1 )
17try:
18    data[ 'comment' ] = sys.argv[4]
19except IndexError:
20    data[ 'comment' ] = ''
21
22update( sys.argv[1], sys.argv[2], data, return_formatted=True )