import json
resultAut = urllib.request.urlopen(urlServer, newJson1.encode('utf-8'))
res = resultAut.read()
code = json.loads(res)[0]['codeError']
print(code)
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/dek/test.py", line 20, in <module>
code = json.loads(res)[0]['codeError']
File "C:\Users\user\AppData\Local\Programs\Python\Python35-32\lib\json\__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
myApp.controller("extendedSearchCtrl", function($scope, $location, $http){
$scope.saveOffice = function (office) {
$location.path(office);
};
});
myApp.controller("courseCtrl", function($scope, $location, $http){
$scope.goBaseCourse = function (course) {
var secondPath = $location.path();
$location.path(secondPath + "/" + course);
};
});
myApp.controller("listGroupCtrl", function($scope, $location, $http){
$scope.req = {};
$scope.getGroup = $location.path();
$scope.req.course = $scope.getGroup.split('/')[2];
$scope.req.office = $scope.getGroup.split('/')[1];
$http.post("../server/mainsearch.php", $scope.req).success(function (answ) {
$scope.response = answ;
});
});