habitica-scripts
habitica-scripts copied to clipboard
Push todos to with duedates to top isn't working sometimes
When I try to run push-todos-with-duedates-to-top.py, nothing happens. It appears it doesn't rearrange my To Do's. Debugging it with pdb, it appears that it isn't pulling a list of my To Do's at all.
Nothing at all happens? Did you follow the setup instructions in the README? What command-line arguments you are including?
I did follow the setup instructions.
I ran the python script in a small shell script, which sets the HAB_API_USER and HAB_API_TOKEN environment to the appropriate values, than runs the python script.
If you ran the Python script from within a shell script, you may need to export the HAB_API_USER and HAB_API_TOKEN variables
export HAB_API_USER=<user_id>
export HAB_API_TOKEN=<token>
I did that in my script. Are you sure the python script works?
Yes, I use it multiple times a day
Have you tried running the script with the -u and -k arguments instead of relying on environment variables?
I haven't, yet.
But I did just notice a possible bug in the script. If you look at line 86 (of the latest script at this time), if the baseurl doesn't have an ending '/', it will query a non-existent url, especially if you use the default 'https://habitica.com' value, like I've been using. So if I use the default 'https://habitica.com' + 'tasks/user?type=todos', the url will be 'https://habitica.comtasks/user?type=todos' instead of the intended 'https://habitica.com/tasks/user?type=todos'
Slashes are appended in line 57
args.baseurl += "/api/v3/"
My bad, I was looking at it late at night. It kinda of works with the -u and -k parameters.
It seems to only work, if the due date is 1 or more days in the past. If the due date is today or further in the future, it doesn't seem to push it to the top.