Hi, I'm Samuel Cochran

on Twitter, Facebook, Google, LinkedIn, GitHub, Stack Overflow, and Steam.

Google Provisioning API 5-day delete restriction hack

Deleting a Google Apps user using the Provisioning API results in the username being unavailable for five days. To work around this recently in the UWA Google Apps migration I recently added this to my wrapper:

class GoogleUsers(object):
    """ Pythonic interface to Google Provisioning API. """
    # ...
    def __delitem__(self, key):
        delete_key = 'delete%d%d' % (time.time(), os.getpid())
        self.gdata_api.RenameUser(key, delete_key)
        self.gdata_api.DeleteUser(delete_key)
    # ...

Yep, renaming it then deleting it works great.