Merge pull request #11 from oscherler/master

Fix the command line tool to actually use the -F options.
This commit is contained in:
James Walker 2012-04-16 16:12:44 -07:00
commit d88d3d7ebb

View file

@ -45,12 +45,17 @@ def main(args=sys.argv[1:]):
client = OpenPhoto(options.host, consumer_key, consumer_secret, token, token_secret) client = OpenPhoto(options.host, consumer_key, consumer_secret, token, token_secret)
if options.method == "GET": if options.method == "GET":
result = client.get(options.endpoint) result = client.get(options.endpoint, params)
else: else:
result = client.post(options.endpoint) result = client.post(options.endpoint, params)
if options.verbose: if options.verbose:
print "==========\nMethod: %s\nHost: %s\nEndpoint: %s\n==========\n\n" % (options.method, options.host, options.endpoint) print "==========\nMethod: %s\nHost: %s\nEndpoint: %s" % (options.method, options.host, options.endpoint)
if len( params ) > 0:
print "Fields:"
for kv in params.iteritems():
print " %s=%s" % kv
print "==========\n"
if options.pretty: if options.pretty:
print json.dumps(json.loads(result), sort_keys=True, indent=4, separators=(',',':')) print json.dumps(json.loads(result), sort_keys=True, indent=4, separators=(',',':'))