/usr/bin/txaws-get-object is in python-txaws 0.2.3-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/python
"""
%prog [options]
"""
import sys
from txaws.credentials import AWSCredentials
from txaws.script import parse_options
from txaws.service import AWSServiceRegion
from txaws.reactor import reactor
def printResults(results):
print results
return 0
def printError(error):
print error.value
return 1
def finish(return_code):
reactor.stop(exitStatus=return_code)
options, args = parse_options(__doc__.strip())
if options.bucket is None:
print "Error Message: A bucket name is required."
sys.exit(1)
if options.object_name is None:
print "Error Message: An object name is required."
sys.exit(1)
creds = AWSCredentials(options.access_key, options.secret_key)
region = AWSServiceRegion(
creds=creds, region=options.region, s3_uri=options.url)
client = region.get_s3_client()
d = client.get_object(options.bucket, options.object_name)
d.addCallback(printResults)
d.addErrback(printError)
d.addCallback(finish)
# We use a custom reactor so that we can return the exit status from
# reactor.run().
sys.exit(reactor.run())
|