Skip to content

Instantly share code, notes, and snippets.

@fhoek
Created January 15, 2019 19:30
Show Gist options
  • Save fhoek/574e495efde979362d43bc86ee492417 to your computer and use it in GitHub Desktop.
Save fhoek/574e495efde979362d43bc86ee492417 to your computer and use it in GitHub Desktop.
Permanently delete a user in zendesk
#!/usr/bin/env python
#
# Copyright 2019 Trancon B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__author__ = 'Frank van den Hoek'
__copyright__ = 'Copyright 2019, Trancon B.V.'
# Import the Zenpy Class
from zenpy import Zenpy
# An API token
creds = {
'email' : '',
'token' : '',
'subdomain': ''
}
zenpy_client = Zenpy(**creds)
for deleted in zenpy_client.users.deleted():
print u'Permanently deleting {} - {}'.format(deleted.name, deleted.email)
try:
zenpy_client.users.permanently_delete(deleted.id)
print 'Done'
except:
print 'Failed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment