Aug-30-2018, 08:07 PM
So I assume you download it as csv and then pass the path/filename as argument
read_file function will not work in this case because it expects json, not csv file
so best is to use csv module
read_file function will not work in this case because it expects json, not csv file
so best is to use csv module
import requests import sys,os import datetime import json,time from functions import read_file,getdate from functions import getcurrentdate,constructJson_Request from functions import postURL,send_mail import csv currentdate = getcurrentdate() config_filepath = os.getcwd()+"/configuration.json" configuration = read_file(config_filepath,"configuration") with open(sys.argv[1]) as workorder_file: rdr = csv.DictReader(workorder_file) for req in rdr: send_to = req['emailid'] subject = "Request ID:" + req['workorderid'] + " - Reminder 1" text = "Request ID:" + req['workorderid'] + " - Reminder 1" resp = send_mail(configuration, send_to, subject, text) print("Mail Sent" + resp)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs