Skip to content

Commit 6af0009

Browse files
add some help center endpoints
always inject credentials into the request
1 parent 1b256c3 commit 6af0009

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

zendesk/endpoints_v2.py

+45
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,51 @@
657657
'valid_params' : ['ids'],
658658
'method': 'DELETE',
659659
},
660+
661+
# Help Center
662+
'list_categories': {
663+
'path': '/help_center/categories.json',
664+
'method': 'GET',
665+
},
666+
667+
'show_category': {
668+
'path': '/help_center/categories/{{category_id}}.json',
669+
'method': 'GET',
670+
},
671+
672+
'list_category_sections': {
673+
'path': '/help_center/categories/{{category_id}}/sections.json',
674+
'method': 'GET',
675+
},
676+
677+
'show_section': {
678+
'path': '/help_center/sections/{{section_id}}.json',
679+
'method': 'GET',
680+
},
681+
682+
'list_category_articles': {
683+
'path': '/help_center/categories/{{category_id}}/articles.json',
684+
'valid_params': ['include'],
685+
'method': 'GET',
686+
},
687+
688+
'list_section_articles': {
689+
'path': '/help_center/sections/{{section_id}}/articles.json',
690+
'method': 'GET',
691+
},
692+
693+
'list_articles': {
694+
'path': '/help_center/articles.json',
695+
'method': 'GET',
696+
},
697+
698+
'show_article': {
699+
'path': '/help_center/articles/{{article_id}}.json',
700+
'method': 'GET',
701+
},
702+
703+
704+
660705
}
661706

662707
# Patch mapping table with correct HTTP Status expected

zendesk/zendesk.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,19 @@ def call(self, **kwargs):
189189
# the 'search' endpoint in an open Zendesk site doesn't return a
190190
# 401 to force authentication. Inject the credentials in the
191191
# headers to ensure we get the results we're looking for
192-
if re.match("^/search\..*", path):
193-
self.headers["Authorization"] = "Basic %s" % (
192+
# if re.match("^/search\..*", path):
193+
# self.headers["Authorization"] = "Basic %s" % (
194+
# base64.b64encode(self.zendesk_username + ':' +
195+
# self.zendesk_password))
196+
# elif "Authorization" in self.headers:
197+
# del(self.headers["Authorization"])
198+
199+
# always inject the credentials, this seems to be required for
200+
# help center endpoints
201+
self.headers["Authorization"] = "Basic %s" % (
194202
base64.b64encode(self.zendesk_username + ':' +
195203
self.zendesk_password))
196-
elif "Authorization" in self.headers:
197-
del(self.headers["Authorization"])
204+
198205

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

0 commit comments

Comments
 (0)