Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: maxgutman/zendesk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: qualaris/zendesk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Dec 9, 2014

  1. add some help center endpoints

    always inject credentials into the request
    craigteegarden committed Dec 9, 2014
    Copy the full SHA
    6af0009 View commit details
Showing with 56 additions and 4 deletions.
  1. +45 −0 zendesk/endpoints_v2.py
  2. +11 −4 zendesk/zendesk.py
45 changes: 45 additions & 0 deletions zendesk/endpoints_v2.py
Original file line number Diff line number Diff line change
@@ -657,6 +657,51 @@
'valid_params' : ['ids'],
'method': 'DELETE',
},

# Help Center
'list_categories': {
'path': '/help_center/categories.json',
'method': 'GET',
},

'show_category': {
'path': '/help_center/categories/{{category_id}}.json',
'method': 'GET',
},

'list_category_sections': {
'path': '/help_center/categories/{{category_id}}/sections.json',
'method': 'GET',
},

'show_section': {
'path': '/help_center/sections/{{section_id}}.json',
'method': 'GET',
},

'list_category_articles': {
'path': '/help_center/categories/{{category_id}}/articles.json',
'valid_params': ['include'],
'method': 'GET',
},

'list_section_articles': {
'path': '/help_center/sections/{{section_id}}/articles.json',
'method': 'GET',
},

'list_articles': {
'path': '/help_center/articles.json',
'method': 'GET',
},

'show_article': {
'path': '/help_center/articles/{{article_id}}.json',
'method': 'GET',
},



}

# Patch mapping table with correct HTTP Status expected
15 changes: 11 additions & 4 deletions zendesk/zendesk.py
Original file line number Diff line number Diff line change
@@ -189,12 +189,19 @@ def call(self, **kwargs):
# the 'search' endpoint in an open Zendesk site doesn't return a
# 401 to force authentication. Inject the credentials in the
# headers to ensure we get the results we're looking for
if re.match("^/search\..*", path):
self.headers["Authorization"] = "Basic %s" % (
# if re.match("^/search\..*", path):
# self.headers["Authorization"] = "Basic %s" % (
# base64.b64encode(self.zendesk_username + ':' +
# self.zendesk_password))
# elif "Authorization" in self.headers:
# del(self.headers["Authorization"])

# always inject the credentials, this seems to be required for
# help center endpoints
self.headers["Authorization"] = "Basic %s" % (
base64.b64encode(self.zendesk_username + ':' +
self.zendesk_password))
elif "Authorization" in self.headers:
del(self.headers["Authorization"])


# Make an http request (data replacements are finalized)
response, content = \