本文整理汇总了Python中pytas.http.TASClient.get_departments方法的典型用法代码示例。如果您正苦于以下问题:Python TASClient.get_departments方法的具体用法?Python TASClient.get_departments怎么用?Python TASClient.get_departments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pytas.http.TASClient
的用法示例。
在下文中一共展示了TASClient.get_departments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_departments_json
# 需要导入模块: from pytas.http import TASClient [as 别名]
# 或者: from pytas.http.TASClient import get_departments [as 别名]
def get_departments_json(request):
institutionId = request.GET.get('institutionId')
if institutionId:
tas = TASClient()
departments = tas.get_departments(institutionId)
else:
departments = {}
return HttpResponse(json.dumps(departments), content_type='application/json')
示例2: get_department_choices
# 需要导入模块: from pytas.http import TASClient [as 别名]
# 或者: from pytas.http.TASClient import get_departments [as 别名]
def get_department_choices(institutionId):
tas = TASClient()
departments_list = tas.get_departments(institutionId)
return (('', 'Choose one'),) + tuple((c['id'], c['name']) for c in departments_list)