@@ -87,23 +87,25 @@ def get_tasks(token):
87
87
new_hab = main .make_hab_from_tod (tod )
88
88
newDict = new_hab .task_dict
89
89
r = main .write_hab_task (newDict )
90
- print ("Added hab to %s!" % tod .name )
91
- print (r )
92
90
if r .ok == False :
93
- fin_hab = main .get_hab_fromID (tid )
91
+ errMsg = r .json ()['errors' ][0 ]['message' ]
92
+ alias = r .json ()['errors' ][0 ]['value' ]
93
+ print ("ERROR: Code: " + str (r .status_code )+ ", Error message: \" "
94
+ + errMsg + "\" , Task alias: " + alias )
94
95
else :
96
+ print ("Added hab to %s!" % tod .name )
95
97
fin_hab = main .get_hab_fromID (tid )
96
- matchDict [tid ] = {}
97
- matchDict [tid ]['tod' ] = tod
98
- matchDict [tid ]['hab' ] = fin_hab
99
- matchDict [tid ]['recurs' ] = tod .recurring
100
- if matchDict [tid ]['recurs' ] == 'Yes' :
101
- if tod .dueToday == 'Yes' :
102
- matchDict [tid ]['duelast' ] = 'Yes'
98
+ matchDict [tid ] = {}
99
+ matchDict [tid ]['tod' ] = tod
100
+ matchDict [tid ]['hab' ] = fin_hab
101
+ matchDict [tid ]['recurs' ] = tod .recurring
102
+ if matchDict [tid ]['recurs' ] == 'Yes' :
103
+ if tod .dueToday == 'Yes' :
104
+ matchDict [tid ]['duelast' ] = 'Yes'
105
+ else :
106
+ matchDict [tid ]['duelast' ] = 'No'
103
107
else :
104
- matchDict [tid ]['duelast' ] = 'No'
105
- else :
106
- matchDict [tid ]['duelast' ] = 'NA'
108
+ matchDict [tid ]['duelast' ] = 'NA'
107
109
108
110
#Check that anything which has recently been completed gets updated in habitica
109
111
for tid in matchDict :
0 commit comments