0% found this document useful (0 votes)
2 views2 pages

Python Script for HR Data Reporting

Uploaded by

Margi Fitriawan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Python Script for HR Data Reporting

Uploaded by

Margi Fitriawan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import datetime

import glob
from datetime import datetime
from datetime import timedelta
import os

[Link]('echo Start : >> ./log_app.log')


[Link]('date >> ./log_app.log')

ip_host = '[Link]'

tanggal_YYYYMMDD = ([Link]() - timedelta(1)).strftime('%Y%m%d')


current_YYYYMMDD = ([Link]() - timedelta(0)).strftime('%Y%m%d')

#################################### Collector File HR


##########################################

list_cabang = ['A','B','C']

count = 0

string_csv = ""
print 'Named explicitly:'
for kode_cabang in list_cabang :

file = "/var/SMFD/SMFD_"+name+"_"+str(tanggal_YYYYMMDD)+".csv"
find_file = [Link](file)
if find_file is None:
string_csv = string_csv + str(kode_cabang)

###################################################################################
#############
csv_file_path = 'output/SMFDbelumditerima'+str(current_YYYYMMDD)+'.xls'
header = ['kdcab']

with open(csv_file_path,'w',newline='') as csv_file:


writer = [Link](csv_file,delimiter='|')
[Link](header)
[Link](string_csv)

url = f'[Link]
for chat_id in chat_ids:
with open(csv_file_path, 'rb') as csv_file:
files = {'document': csv_file}
params = {
'chat_id': chat_id,
'caption': 'Laporan SMFD'
}

# Send Message ke Receiver


response = [Link](url, params=params, files=files)

if response.status_code == 200:
[Link]("Sent Successfully to ID "+chat_id)
else:
[Link]("Sent Failed to ID " + chat_id)

You might also like