# HG changeset patch # User DaveM # Date 1520541404 0 # Node ID a5b8e2b91d8fd87e5ec1121b3ad642ee4b8e05f9 # Parent 0264a7888d542d7989bd872217432f17306f6b37 fixing None Planets bug and reformatting output of fullResults diff -r 0264a7888d54 -r a5b8e2b91d8f V4/runme.py --- 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: diff -r 0264a7888d54 -r a5b8e2b91d8f V4/synastry.py --- a/V4/synastry.py Wed Mar 07 11:02:55 2018 +0000 +++ b/V4/synastry.py Thu Mar 08 20:36:44 2018 +0000 @@ -100,6 +100,7 @@ self.p_tob = personDict['pTOB'] self.p_cob = personDict['pCOB'] self.horiscope = None + self.resp = None def identifyIssues(self): if self.id is None: @@ -192,6 +193,13 @@ return self.resp def parsePage(self): + self.horiscope = None + if('Please use valid date.' in self.resp.content): + self.issue = 'dob' + return self.horiscope + elif('Please use valid time.' in self.resp.content): + self.issue = 'tob' + return self.horiscope gotLocation = 0 self.horiscope = planetPositions() soup = BeautifulSoup(self.resp.content, 'lxml') @@ -277,6 +285,14 @@ if (self.planets[component].houseA == houseNo) or (self.planets[component].houseB == houseNo): return True return False + + def makeAllAspectTreple(self): + self.aspectTreple = {} + for p1 in planetPositions.planetNames: + for p2 in planetPositions.planetNames: + aspect = self.calcAspect(p1,p2)[0] + if aspect is not None: + self.aspectTreple[(p1,p2,aspect)] = 1 def calcAllAspects(self): for p1 in planetPositions.planetNames: diff -r 0264a7888d54 -r a5b8e2b91d8f timesheet.xlsx Binary file timesheet.xlsx has changed