Created
September 6, 2012 12:07
-
-
Save tkadlubo/3655559 to your computer and use it in GitHub Desktop.
Destroy a beeminder goal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# BEEM DESTROYER by Tadeusz Andrzej Kadłubowski | |
# Beem Destroyer is a script that deletes all the data points from a Beeminder goal. | |
# If you want to irrevocably destroy a goal, you first need to delete all the data | |
# that you put on it. This tool will help you with that. After using the Beem Destroyer | |
# you need to go to http://beeminder.com, view your goal's data tab (which should be | |
# empty now), and manually click "irrevocably destroy". | |
# EDIT THE SETTINGS BELOW | |
# Your Beeminder username | |
username = "john_doe" | |
# Get your personal Beeminder auth token (after signing in) from | |
# https://www.beeminder.com/api/v1/auth_token.json | |
auth_token = "abc123abc123abc123" | |
# The goal to delete | |
goal = "take_over_the_world" | |
import httplib | |
import json | |
from datetime import date | |
import time | |
def get_goal_datapoints(): | |
connection = httplib.HTTPSConnection('www.beeminder.com') | |
connection.request("GET", "/api/v1/users/%s/goals/%s/datapoints.json?auth_token=%s"%(username, goal, auth_token)) | |
return json.loads(connection.getresponse().read()) | |
def delete_datapoint(datapoint): | |
print date.fromtimestamp(datapoint["timestamp"]) | |
connection = httplib.HTTPSConnection('www.beeminder.com') | |
connection.request("DELETE", "/api/v1/users/%s/goals/%s/datapoints/%s.json?auth_token=%s"%(username, goal, datapoint["id"], auth_token)) | |
data = json.loads(connection.getresponse().read()) | |
time.sleep(2) | |
map(delete_datapoint, get_goal_datapoints()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivated in part by this (seriously, thank you), we finally have an Archive button now.
So we're getting rid of the option to delete goals after removing all the datapoints.
So this is now obsolete. Phew!