feat: changed output format
This commit is contained in:
@@ -9,6 +9,7 @@ License: This program is released under the MIT License
|
||||
import boto3
|
||||
from datetime import datetime, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import humanize
|
||||
|
||||
# Main function
|
||||
def main() -> None:
|
||||
@@ -41,10 +42,9 @@ def main() -> None:
|
||||
)
|
||||
reqs_total = reqs_resp['Datapoints'][0]['Sum'] if reqs_resp['Datapoints'] else 0
|
||||
|
||||
gb = round(bytes_total / (1024 ** 3), 2) if bytes_total else 0
|
||||
# only interested in distro with high traffic
|
||||
if gb > 10:
|
||||
print(f"{dist_id} - Month: {start:%Y-%b} Requests: {reqs_total:,.0f} BytesDownloaded: {gb} GB")
|
||||
# only interested in distro with high traffic (>10G)
|
||||
if bytes_total > 10 * 1024 ** 3:
|
||||
print(f"{dist_id}: {start:%Y-%b} Requests: {reqs_total:,.0f} BytesDownloaded: {humanize.naturalsize(bytes_total)}")
|
||||
|
||||
|
||||
# Call main function
|
||||
|
||||
Reference in New Issue
Block a user