8
from txaws.credentials import AWSCredentials
9
from txaws.script import parse_options
10
from txaws.service import AWSServiceRegion
11
from txaws.reactor import reactor
14
def printResults(results):
19
def printError(error):
24
def finish(return_code):
25
reactor.stop(exitStatus=return_code)
28
options, args = parse_options(__doc__.strip())
29
if options.bucket is None:
30
print "Error Message: A bucket name is required."
32
if options.object_name is None:
33
print "Error Message: An object name is required."
35
creds = AWSCredentials(options.access_key, options.secret_key)
36
region = AWSServiceRegion(
37
creds=creds, region=options.region, s3_uri=options.url)
38
client = region.get_s3_client()
40
d = client.delete_object(options.bucket, options.object_name)
41
d.addCallback(printResults)
42
d.addErrback(printError)
44
# We use a custom reactor so that we can return the exit status from
46
sys.exit(reactor.run())