customer key fix and fetch directory change.

master
bleeson 2025-02-13 08:58:36 -08:00
parent 02b96fa6fb
commit 4bad44dd58
1 changed files with 3 additions and 3 deletions

View File

@ -66,11 +66,11 @@ def retrieve_x12_edi_files_shandex():
hostname=SHANDEX_SFTP_HOST, username=SHANDEX_SFTP_USERNAME, password=SHANDEX_SFTP_PASSWORD hostname=SHANDEX_SFTP_HOST, username=SHANDEX_SFTP_USERNAME, password=SHANDEX_SFTP_PASSWORD
) )
with ssh_client.open_sftp() as sftp_connection: with ssh_client.open_sftp() as sftp_connection:
sftp_connection.chdir("/Stash/Test/FromShandex") #TODO update this to Production folder sftp_connection.chdir("/Stash/Prod/FromShandex/Reports") #TODO update this to Production folder
for filename in sftp_connection.listdir(): for filename in sftp_connection.listdir():
if filename.startswith("Stash_Tea_Order_Data"): if filename.startswith("Stash_Tea_Order_Data"):
sftp_connection.get(filename, INCOMING_DIRECTORY / filename) sftp_connection.get(filename, INCOMING_DIRECTORY / filename)
new_filename = f"/Stash/Test/FromShandex/Archive/{filename}" new_filename = f"/Stash/Prod/FromShandex/Reports/Archive/{filename}"
sftp_connection.rename(filename, new_filename) sftp_connection.rename(filename, new_filename)
def process_file(file): def process_file(file):
@ -81,7 +81,7 @@ def process_file(file):
for row in reader: for row in reader:
if row: if row:
key_dict = { key_dict = {
"customerkey":row[0] + '_' + row[9], "customerkey":row[7] + '_' + row[9],
"customer_order_number":row[0], "customer_order_number":row[0],
"customer_po":row[1], "customer_po":row[1],
"Order_Type":row[2], "Order_Type":row[2],