Created
February 16, 2012 18:29
-
-
Save slpsys/1846888 to your computer and use it in GitHub Desktop.
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
def _postToZendesk(self, text, originalMsg): | |
try: | |
url = 'http://xignite.zendesk.com/tickets/%s.xml' % (text) | |
body = self._getZendeskMessage(originalMsg) | |
auth_handler = urllib2.HTTPBasicAuthHandler() | |
auth_handler.add_password('Web Password', url,'username', 'password') | |
opener = urllib2.build_opener(auth_handler) | |
request = urllib2.Request(url, data=body) | |
request.add_header('Content-Type', 'application/xml') | |
request.get_method = lambda: 'PUT' | |
url = opener.open(request) | |
except: | |
print 'Could not post to Zendesk, please let the user know that the ticket has been updated manually.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment