All user content from this site has been deleted.
Visit SeedMeLab project as a new option for data hosting.

Delete all your collections

The following Python script provides an easy way to delete all your collections.
Caution: Deletes every collection in your SeedMe account
Sleeps for 30 seconds between consecutive deletions, so consider running this for a long uninterrupted period if you have several collections

#!/usr/bin/env python

""" Deletes all collections for your account.
Note: The script sleeps for 30 seconds between consecutive deletions, so consider running this for a long uninterrupted period if you have several collections.

1. seedme module must be installed or should be in same folder
2. % python

import json
import time
import sys

    import seedme
except ImportError:
    print 'Error: seedme module not found'
    print 'Install seedme with % pip install seedme'
    print 'OR'
    print 'Use self contained SeedMe module from here ' +\
    print 'Move this file into the unzipped SeedMe module directory'

# @see
def query_yes_no(question, default="yes"):
    """Ask a yes/no question via raw_input() and return their answer.

    "question" is a string that is presented to the user.
    "default" is the presumed answer if the user just hits .
        It must be "yes" (the default), "no" or None (meaning
        an answer is required of the user).

    The "answer" return value is one of "yes" or "no".
    valid = {"yes":"yes",   "y":"yes",  "ye":"yes",
             "no":"no",     "n":"no"}
    if default == None:
        prompt = " [y/n] "
    elif default == "yes":
        prompt = " [Y/n] "
    elif default == "no":
        prompt = " [y/N] "
        raise ValueError("invalid default answer: '%s'" % default)

    while 1:
        sys.stdout.write(question + prompt)
        choice = raw_input().lower()
        if default is not None and choice == '':
            return default
        elif choice in valid.keys():
            return valid[choice]
            sys.stdout.write("Please respond with 'yes' or 'no' "\
                             "(or 'y' or 'n').\n")

# Sanity checks
check = query_yes_no('Delete all your collections?')
if 'no' in check:

check_again = query_yes_no('Are you sure you want to delete all your collections?')
if 'no' in check_again:

# Create an object from SeedMe class
obj = seedme.SeedMe()

# Fetch list of all collections
response = obj.query()
json_object = json.loads(response)
del obj

# Grab all collections in a list
collections = []
for c in json_object['results']:

if not collections:
    print ('Nothing to delete as no collections were found for your accout')

# Now lets delete all collections
# Pause 30 seconds between deletion to avoid DDOS
n = 30
for i, x in enumerate(collections, 1):
    obj = seedme.SeedMe()
    del obj
    print 'Deleted ' + str(i) + ' of ' + str(len(collections)) + '; ID: ' + x
    if i != len(collections):
        print 'Sleeping for ' + str(n) + ' seconds'
        time.sleep(n)  # Delay for 1 minute (60 seconds)

print 'Deleted all your collections'