reworked output generator, added Discord support
This commit is contained in:
@@ -14,7 +14,7 @@ webhook = DiscordWebhook(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dirpath = "."
|
||||||
FILE = [filename for filename in os.listdir(dirpath) if filename.startswith("TMCZ_")]
|
FILE = [filename for filename in os.listdir(dirpath) if filename.startswith("TMCZ_")]
|
||||||
FILE = FILE[0]
|
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']
|
csv_columns = ['takhleuztoneudelam', 'data', 'sms', 'other', 'smscount']
|
||||||
try:
|
try:
|
||||||
with open('output_TMCZ_'+ext_date_from_filaname, 'w') as csvfile:
|
with open('output_TMCZ_'+ext_date_from_filaname, 'w') as csvfile:
|
||||||
@@ -168,3 +200,4 @@ try:
|
|||||||
except IOError:
|
except IOError:
|
||||||
print(f"I/O error: {IOError}")
|
print(f"I/O error: {IOError}")
|
||||||
|
|
||||||
|
"""
|
||||||
Reference in New Issue
Block a user