work around non confirmity of the web services
This commit is contained in:
parent
483a66aa89
commit
76e8041ef1
|
@ -38,7 +38,7 @@ class BlackboardConnector(object):
|
|||
|
||||
def _get_course_helper(self, r):
|
||||
r.encoding = 'utf-8'
|
||||
if r.status_code == 200:
|
||||
if r.status_code == 200 and r.content.startswith('<'):
|
||||
try:
|
||||
x = etree.XML(r.content)
|
||||
except etree.ParseError:
|
||||
|
@ -59,7 +59,7 @@ class BlackboardConnector(object):
|
|||
courses.append(course)
|
||||
return True, CourseByOwnerResponse(info_message_elt.text.strip(),
|
||||
courses)
|
||||
elif r.status_code == 400:
|
||||
elif r.status_code in (200,400):
|
||||
return False, r.text
|
||||
else:
|
||||
logging.error('BlackBoard code HTTP %s', r.status_code)
|
||||
|
@ -127,7 +127,7 @@ class BlackboardConnector(object):
|
|||
|
||||
def get_categories(self):
|
||||
r = self.send_request('GetCategories')
|
||||
if r.status_code == 200:
|
||||
if r.status_code == 200 and r.content.startswith('<'):
|
||||
x = etree.XML(r.content)
|
||||
info_message_elt = x.find('infoMessage')
|
||||
category_elts = x.findall('categories/category')
|
||||
|
@ -140,7 +140,7 @@ class BlackboardConnector(object):
|
|||
categories.append(category)
|
||||
return True, GetCategoryResponse(info_message_elt.text.strip(),
|
||||
categories)
|
||||
elif r.status_code == 400:
|
||||
elif r.status_code in (200,400):
|
||||
return False, r.text
|
||||
else:
|
||||
print r.text
|
||||
|
|
Reference in New Issue