Skip to content

Instantly share code, notes, and snippets.

@tkadlubo
Created September 6, 2012 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkadlubo/3655559 to your computer and use it in GitHub Desktop.
Save tkadlubo/3655559 to your computer and use it in GitHub Desktop.
Destroy a beeminder goal
#!/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())
@dreeves
Copy link

dreeves commented Apr 15, 2013

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment