(20251114) Both APIs ready for production test.

This commit is contained in:
2025-11-14 19:06:00 +05:30
parent 6ddc0e6966
commit a2f6390755
7 changed files with 440 additions and 56 deletions
+56 -51
View File
@@ -1197,42 +1197,42 @@ if __name__ == "__main__":
print("User Data :", user_data_dir)
print("Downloads :", downloads_dir)
# Create an instance of the automation object:
cosec = CosecWeb(
cosec_url = "http://103.89.8.21/cosec",
username = "hrd1",
password = "cosec",
driver_dir = chrome_driver_dir,
user_data_dir = user_data_dir,
downloads_dir = downloads_dir,
)
# # Create an instance of the automation object:
# cosec = CosecWeb(
# cosec_url = "http://103.89.8.21/cosec",
# username = "hrd1",
# password = "cosec",
# driver_dir = chrome_driver_dir,
# user_data_dir = user_data_dir,
# downloads_dir = downloads_dir,
# )
#
# # Perform the login:
# cosec.login(initial_sleep = 2.5)
#
# # Get the in/out report:
# in_out_report_path = cosec.get_in_out_summary(
# initial_sleep = 1.0,
# from_date = datetime.datetime.now() - datetime.timedelta(days = 1),
# to_date = datetime.datetime.now(),
# group_ids = [
# "2", # ... Velankani Information Systems Pvt Ltd
# "3", # ... Velankani Bydesign India Pvt Ltd
# "4", # ... Velankani Electronics & Automotive Pvt Ltd
# ],
# download_timeout = 60.0
# )
#
# # Convert the In/Out Summary to a Pandas DF:
# # in_out_report_path = r"D:\programming\python\elcita_ofc_2025\downloads\Monthly_Details.xls"
# in_out_report_df = cosec.read_in_out_summary_xls(in_out_report_path)
# in_out_report_df = in_out_report_df[:35]
# print(in_out_report_df.to_string())
# print("\n\n---\n\n")
# # print(in_out_report_df.info())
# Perform the login:
cosec.login(initial_sleep = 2.5)
# Get the in/out report:
in_out_report_path = cosec.get_in_out_summary(
initial_sleep = 1.0,
from_date = datetime.datetime.now() - datetime.timedelta(days = 1),
to_date = datetime.datetime.now(),
group_ids = [
"2", # ... Velankani Information Systems Pvt Ltd
"3", # ... Velankani Bydesign India Pvt Ltd
"4", # ... Velankani Electronics & Automotive Pvt Ltd
],
download_timeout = 60.0
)
# Convert the In/Out Summary to a Pandas DF:
# in_out_report_path = r"D:\programming\python\elcita_ofc_2025\downloads\Monthly_Details.xls"
in_out_report_df = cosec.read_in_out_summary_xls(in_out_report_path)
in_out_report_df = in_out_report_df[:35]
print(in_out_report_df.to_string())
print("\n\n---\n\n")
# print(in_out_report_df.info())
# Go back to the home page:
cosec.return_home()
# # Go back to the home page:
# cosec.return_home()
# # Get the muster roll:
# muster_roll_path = cosec.get_muster_roll(
@@ -1246,20 +1246,25 @@ if __name__ == "__main__":
# download_timeout = 60.0
# )
#
# # Convert the Muster Roll to a Pandas DF:
# # muster_roll_path = r"D:\programming\python\elcita_ofc_2025\downloads\Monthly_Details.xls"
# muster_roll_df = CosecWeb.read_muster_roll_xls(muster_roll_path)
# muster_roll_df = muster_roll_df[:35]
# print(muster_roll_df.to_string())
# print("\n\n---\n\n")
# # print(muster_roll_df.info())
# Convert the Muster Roll to a Pandas DF:
muster_roll_path = r"D:\kps\PycharmProjects\cosec\downloads\Monthly_Details.xls"
muster_roll_df = CosecWeb.read_muster_roll_xls(muster_roll_path)
muster_roll_df = muster_roll_df[[
"User ID", "User Name", "Category Name",
"Grade Name", "Branch Name", "Department Name",
"Direct Reporting", "Level-1"
]]
muster_roll_df = muster_roll_df[:35]
print(muster_roll_df.to_string())
print("\n\n---\n\n")
print(muster_roll_df.info())
# Log out to end the cycle:
cosec.logout()
# Close the browser window:
cosec.quit()
# Just to see what's going on,
# doesn't add to the operational requirements:
time.sleep(10.0)
# # Log out to end the cycle:
# cosec.logout()
#
# # Close the browser window:
# cosec.quit()
#
# # Just to see what's going on,
# # doesn't add to the operational requirements:
# time.sleep(10.0)