comparison V2/runme.py @ 4:99115e36316b

developing and testing DOB and TOB gathering, and implementing geo-location to latitude coordinates
author DaveM
date Mon, 11 Dec 2017 11:29:38 +0000
parents c2898c2a3cc6
children 3d5ca8e78f8f
comparison
equal deleted inserted replaced
3:c2898c2a3cc6 4:99115e36316b
54 def requestURL(url,payload): 54 def requestURL(url,payload):
55 r = requests.get(url, params=payload) 55 r = requests.get(url, params=payload)
56 time.sleep(5) 56 time.sleep(5)
57 return r 57 return r
58 58
59 def parseCSV(filename): 59 # def parseCSV(filename):
60 stream = csv.DictReader(open(filename,'rb')) 60 # stream = csv.DictReader(open(filename,'rb'))
61 dictList = [] 61 # dictList = []
62 for line in stream: 62 # for line in stream:
63 dictList.append(dp.regulateData(line)) 63 # dictList.append(regulateData(line))
64 64
65 # dictList = headerParse(dictList) 65 # # dictList = headerParse(dictList)
66 # dictList = validateData(dictList) 66 # # dictList = validateData(dictList)
67 return dictList 67 # return dictList
68 68
69 def printToFile(filename,data): 69 def printToFile(filename,data):
70 keys = data[0].keys() 70 keys = data[0].keys()
71 with open(filename,'w') as stream: 71 with open(filename,'w') as stream:
72 dict_writer = csv.DictWriter(stream, keys) 72 dict_writer = csv.DictWriter(stream, keys)
73 dict_writer.writeheader() 73 dict_writer.writeheader()
74 dict_writer.writerows(data) 74 dict_writer.writerows(data)
75 75
76 def testMain(): 76 def testMain():
77 people = parseCSV('individuals.csv') 77 people = dp.parseCSV('individuals.csv')
78 78
79 def _main(): 79 def _main():
80 # people = dict() 80 # people = dict()
81 people = parseCSV('individuals.csv') 81 people = dp.parseCSV('individuals.csv')
82 horiscopeList = [] 82 horiscopeList = []
83 # people = [1,2,3,4,5] 83 # people = [1,2,3,4,5]
84 for person in people: 84 for person in people:
85 print 'parsing person '+ person['ID'] 85 print 'parsing person '+ person['ID']
86 url,payload = setURL('') 86 url,payload = setURL('')