pep8 and documentation

This commit is contained in:
carnal0wnage
2018-05-02 22:44:58 -04:00
parent 194bf3389a
commit 1c633fe216
48 changed files with 505 additions and 186 deletions

View File

@@ -10,8 +10,8 @@ import sys
pp = pprint.PrettyPrinter(indent=5, width=80)
#from http://docs.aws.amazon.com/general/latest/gr/rande.html
regions = ['us-east-1', 'us-east-2', 'us-west-2', 'eu-west-1' ]
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
regions = ['us-east-1', 'us-east-2', 'us-west-2', 'eu-west-1']
'''
Code to get the AWS_ACCESS_KEY_ID from boto3
@@ -20,6 +20,7 @@ session = boto3.Session()
credentials = session.get_credentials()
AWS_ACCESS_KEY_ID = credentials.access_key
def translate_text(text, source_lang, target_lang):
'''
Translate a block of text from source to target language
@@ -38,7 +39,6 @@ def translate_text(text, source_lang, target_lang):
else:
print("### {}: Translated Text ###\n" .format(region))
print("Translated Text: {}".format(response['TranslatedText']))
print("\n")
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == 'UnauthorizedOperation':
@@ -48,4 +48,4 @@ def translate_text(text, source_lang, target_lang):
else:
print(e)
except KeyboardInterrupt:
print("CTRL-C received, exiting...")
print("CTRL-C received, exiting...")