Mercurial > hg > horiscopes
diff V4/runme.py @ 22:a5b8e2b91d8f
fixing None Planets bug and reformatting output of fullResults
author | DaveM |
---|---|
date | Thu, 08 Mar 2018 20:36:44 +0000 |
parents | 0264a7888d54 |
children | 11d4e438045e |
line wrap: on
line diff
--- a/V4/runme.py Wed Mar 07 11:02:55 2018 +0000 +++ b/V4/runme.py Thu Mar 08 20:36:44 2018 +0000 @@ -44,22 +44,22 @@ keyDict = {} for item in itemList: keyDict[item] = 1 - return keyDict.keys() + return sorted(keyDict.keys()) def outputPeople(filename,people): with open(filename, "wb") as csv_file: dictKeys = [] for person in people: if person.issue is None: - person.horiscope.calcAllAspects() - dictKeys += person.horiscope.aspect.keys() + person.horiscope.makeAllAspectTreple() + dictKeys += person.horiscope.aspectTreple.keys() dictKeys = uniquify(dictKeys) - writer = csv.DictWriter(csv_file, ['id']+dictKeys) + writer = csv.DictWriter(csv_file, ['id','score']+dictKeys) writer.writeheader() for person in people: if person.issue is None: - tempDict = {'id':person.id} - tempDict.update(person.horiscope.aspect) + tempDict = {'id':person.id,'score':person.score} + tempDict.update(person.horiscope.aspectTreple) # pdb.set_trace() writer.writerow(tempDict) @@ -84,6 +84,8 @@ # time.sleep(5) # return r +def loadPickUpdate(filename): + def loadPick(filename): with open(filename, 'rb') as handle: b = pickle.load(handle) @@ -100,8 +102,11 @@ print 'SKIPPING person '+ person.id + ' error with ' + issue else: print 'parsing person '+ person.id - person.makePayload() - person.requestURL() + if person.resp is None: + print 'Posting Request for person '+ person.id + person.makePayload() + person.requestURL() + print 'parsing person '+ person.id person.horiscope = person.parsePage() # person.horiscope.printPositions() if saveFile is not None: