summaryrefslogtreecommitdiffstats
path: root/py3status/modules
diff options
context:
space:
mode:
authorUltrabug <ultrabug@gentoo.org>2015-04-30 10:21:14 +0200
committerUltrabug <ultrabug@gentoo.org>2015-04-30 10:21:14 +0200
commitc641345cef92219085ac936f60dff1cbb8f57012 (patch)
treed5c12a316ac2e4ff12f13e37fdaedf2fec5553e2 /py3status/modules
parent68f75ef6b73d899740d85609917ca7f3824dc7fd (diff)
QA on aws_bill module
Diffstat (limited to 'py3status/modules')
-rwxr-xr-xpy3status/modules/aws_bill.py36
1 files changed, 24 insertions, 12 deletions
diff --git a/py3status/modules/aws_bill.py b/py3status/modules/aws_bill.py
index f2dd5dc..98643f6 100755
--- a/py3status/modules/aws_bill.py
+++ b/py3status/modules/aws_bill.py
@@ -3,16 +3,23 @@
Display the current AWS bill.
##### WARNING #####
-This module generate some costs on the AWS bill. Take care about the cache_timeout to limit these fees !
+This module generate some costs on the AWS bill.
+Take care about the cache_timeout to limit these fees !
##### WARNING #####
Configuration parameters:
- - aws_access_key_id : Your AWS access key
- - aws_account_id : the root ID of the AWS account. Can be find here https://console.aws.amazon.com/billing/home#/account
- - aws_secret_access_key : Your AWS secret key
- - billing_file : csv file location
- - cache_timeout : how often we refresh this module in seconds
- - s3_bucket_name : the bucket where billing files are sent by AWS. Follow this article to activate this feature : http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/detailed-billing-reports.html
+ - aws_access_key_id: Your AWS access key
+ - aws_account_id: the root ID of the AWS account.
+ Can be found here: https://console.aws.amazon.com/billing/home#/account
+ - aws_secret_access_key: Your AWS secret key
+ - billing_file: csv file location
+ - cache_timeout: how often we refresh this module in seconds
+ - s3_bucket_name: the bucket where billing files are sent by AWS.
+ Follow this article to activate this feature:
+ http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/detailed-billing-reports.html
+
+Requires:
+ - boto
@author nawadanp
"""
@@ -26,7 +33,8 @@ from time import time
class Py3status:
-
+ """
+ """
# available configuration parameters
aws_access_key_id = ''
aws_account_id = ''
@@ -38,9 +46,9 @@ class Py3status:
def _get_bill_amount(self):
# Billing file name, generated by Amazon itself
# Format : 123456789012-aws-billing-csv-yyyy-mm.csv
- s3_file_key = self.aws_account_id + '-aws-billing-csv-' + \
- datetime.datetime.now().strftime(
- '%Y') + '-' + datetime.datetime.now().strftime('%m') + '.csv'
+ s3_file_key = '{}-aws-billing-csv-{}-{}.csv'.format(
+ self.aws_account_id, datetime.datetime.now().strftime('%Y'),
+ datetime.datetime.now().strftime('%m'))
i = 0
# Connection to s3 service
@@ -111,7 +119,11 @@ if __name__ == "__main__":
"""
from time import sleep
x = Py3status()
- config = {'color_good': '#00FF00', 'color_bad': '#FF0000', }
+ config = {
+ 'color_bad': '#FF0000',
+ 'color_degraded': '#FFFF00',
+ 'color_good': '#00FF00'
+ }
while True:
print(x.aws_bill([], config))
sleep(1)