reworked output generator, added Discord support

This commit is contained in:
2022-04-12 21:56:19 +02:00
parent 2ce29b7f03
commit fc0c4d16f6

View File

@@ -14,7 +14,7 @@ webhook = DiscordWebhook(
dirpath = "."
FILE = [filename for filename in os.listdir(dirpath) if filename.startswith("TMCZ_")]
FILE = FILE[0]
@@ -154,6 +154,38 @@ print("Count of units: ", len(dictionary.keys()))
with open('output_TMCZ_'+ext_date_from_filaname, 'w') as f:
writer = csv.writer(f)
writer.writerow(["MSISDN","ICCID","IMSI","DATA-PRICE","DATA-AMOUNT","SMS-PRICE","SMS-COUNT","OTHER-PRICE","SIM-STATUS"])
for key in dictionary.keys():
print(key)
print(dictionary[key])
data = dictionary[key]['data']
sms = dictionary[key]['sms']
other = dictionary[key]['other']
smscount = dictionary[key]['smscount']
writer.writerow([key, "N/A", "N/A", data, "N/A", sms, "N/A", other, "N/A"])
f.close()
with open('output_TMCZ_'+ext_date_from_filaname, "rb") as f:
webhook.add_file(file=f.read(), filename='output_TMCZ_'+ext_date_from_filaname)
response = webhook.execute()
"""
csv_columns = ['takhleuztoneudelam', 'data', 'sms', 'other', 'smscount']
try:
with open('output_TMCZ_'+ext_date_from_filaname, 'w') as csvfile:
@@ -168,3 +200,4 @@ try:
except IOError:
print(f"I/O error: {IOError}")
"""