cleanup
This commit is contained in:
@@ -20,8 +20,7 @@ FILE = FILE[0]
|
|||||||
ext_date_from_filaname = FILE.split('_')[-1]
|
ext_date_from_filaname = FILE.split('_')[-1]
|
||||||
print(ext_date_from_filaname)
|
print(ext_date_from_filaname)
|
||||||
|
|
||||||
#usrmonth = input("Month to be processed: ")
|
|
||||||
#usrmonth = int(usrmonth)
|
|
||||||
usrmonth = int(5)
|
usrmonth = int(5)
|
||||||
|
|
||||||
dictionary = {}
|
dictionary = {}
|
||||||
@@ -56,44 +55,15 @@ with open(FILE, newline='', encoding="utf-8") as csvfile:
|
|||||||
reader = csv.DictReader(csvfile, delimiter=';',fieldnames=['faktura_c','phonenumber','direction','productgroup','productser','item','service','datetime','dialnum','time_taken','time_charged','dataamount','realcost','creditcost','discount' 'servicescost','chargedwovat','chargedwvat','privatecall'])
|
reader = csv.DictReader(csvfile, delimiter=';',fieldnames=['faktura_c','phonenumber','direction','productgroup','productser','item','service','datetime','dialnum','time_taken','time_charged','dataamount','realcost','creditcost','discount' 'servicescost','chargedwovat','chargedwvat','privatecall'])
|
||||||
for row in reader:
|
for row in reader:
|
||||||
print("Product serie: ",row['productser'])
|
print("Product serie: ",row['productser'])
|
||||||
|
|
||||||
print("Time taken ",row['time_taken'])
|
print("Time taken ",row['time_taken'])
|
||||||
# sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
#print(row)
|
|
||||||
if row['phonenumber'] == '':
|
if row['phonenumber'] == '':
|
||||||
continue #skip empty phonenumber
|
continue #skip empty phonenumber
|
||||||
# if row['Začátek fakturačního období'] == '':
|
|
||||||
# continue
|
|
||||||
#
|
|
||||||
# my_string = row['Začátek fakturačního období']
|
|
||||||
# #my_string = '2021-09-06'
|
|
||||||
# print("start date: ",my_string)
|
|
||||||
#
|
|
||||||
# try:
|
|
||||||
# my_date = datetime.strptime(my_string, "%d.%m.%Y")
|
|
||||||
# except:
|
|
||||||
# print("An exception occurred, current my_string is: ", my_string)
|
|
||||||
# sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
#print(row['BILLED_PERIOD_START'])
|
|
||||||
#print(my_date.month)
|
|
||||||
|
|
||||||
|
|
||||||
# if usrmonth != my_date.month:
|
|
||||||
# print("skipping bad date")
|
|
||||||
# continue #skip bad dates
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MSISDN = int(row['phonenumber'])
|
MSISDN = int(row['phonenumber'])
|
||||||
#ICCID = int(row['ICCID'])
|
|
||||||
price = row['chargedwovat'].replace(',','.')
|
|
||||||
|
|
||||||
#price = round(price, 5)
|
price = row['chargedwovat'].replace(',','.')
|
||||||
|
|
||||||
typ = None
|
typ = None
|
||||||
|
|
||||||
@@ -106,8 +76,6 @@ with open(FILE, newline='', encoding="utf-8") as csvfile:
|
|||||||
typ = 'other'
|
typ = 'other'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if row['direction'] != "I" and row['productser'] == "SMS ":
|
if row['direction'] != "I" and row['productser'] == "SMS ":
|
||||||
|
|
||||||
pricesms = int(row['time_taken'])
|
pricesms = int(row['time_taken'])
|
||||||
@@ -136,18 +104,6 @@ with open(FILE, newline='', encoding="utf-8") as csvfile:
|
|||||||
print("direction: ", row['direction'], " and productser: ", row['productser'])
|
print("direction: ", row['direction'], " and productser: ", row['productser'])
|
||||||
|
|
||||||
|
|
||||||
#try:
|
|
||||||
#print(dictionary[436761890319959]) #one with both types
|
|
||||||
#except:
|
|
||||||
#print("Required unit is not in our set")
|
|
||||||
#sys.exit(1)
|
|
||||||
|
|
||||||
#print(len(dictionary.keys()))
|
|
||||||
|
|
||||||
#for key, value in dictionary.items():
|
|
||||||
#print(key, ' : ', value)
|
|
||||||
|
|
||||||
|
|
||||||
print("Count of units: ", len(dictionary.keys()))
|
print("Count of units: ", len(dictionary.keys()))
|
||||||
|
|
||||||
|
|
||||||
@@ -173,5 +129,4 @@ with open('output_VFCZ_'+ext_date_from_filaname, 'w') as f:
|
|||||||
with open('output_VFCZ_'+ext_date_from_filaname, "rb") as f:
|
with open('output_VFCZ_'+ext_date_from_filaname, "rb") as f:
|
||||||
webhook.add_file(file=f.read(), filename='output_VFCZ_'+ext_date_from_filaname)
|
webhook.add_file(file=f.read(), filename='output_VFCZ_'+ext_date_from_filaname)
|
||||||
|
|
||||||
response = webhook.execute()
|
response = webhook.execute()
|
||||||
|
|
||||||
Reference in New Issue
Block a user