Hi @Jess,
After copying the code you sent me to run I have found the problem.
First, it is nothing to do with the ks. I have 3 methods for generating a ks (due to me trying to figure out why I was not getting the results) all of which did not give the same result as the web console. This is weird as one of the authentication methods is literally copied and pasted. They all also work with the fixed version of the code though.
However, I digress, after copying and pasting your code it magically worked. At first, I was quite confused, it turns out my method of printing the results was causing the problem. -.-
By simply replacing this…
for obj in result.getObjects():
json_acceptable_string = obj.toParams().toJson()
json_obj = json.loads(json_acceptable_string)
print(json.dumps(json_obj, sort_keys=True, indent=4))
… with this, it fixed the problem
for obj in result.objects:
pprint(vars(obj))
I can’t thank you enough!
May I make a request to add a toString/pretty print method to KalturaResponse
As for sanity reasons I tried to do the same thing in java and got the same result. This is probably because I tried to print the result like this…
for(MediaEntry obj : result.results.getObjects()){
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonParser jp = new JsonParser();
JsonElement je = jp.parse(obj.toParams().toString());
String prettyJsonString = gson.toJson(je);
System.out.println(prettyJsonString);
}
This really threw me when my result were…
body:
{"filter":{"objectType":"KalturaMediaEntryFilter","orderBy":"-createdAt","categoriesIdsMatchOr":"65623171"},"pager":{"objectType":"KalturaFilterPager"},"ignoreNull":true,"format":1,"clientTag":"java:22-01-10","apiVersion":"17.18.0","ks":""}
21:01:03.182: debug - response [935a71ba-a0a7-4b7a-b53b-d3120b3ac5c3::media.list] body:
{"objects":[{"mediaType":1,"conversionQuality":7435211,"sourceType":"6","dataUrl":"dataUrl","flavorParamsIds":"0,487041,487071","plays":2,"views":3,"lastPlayedAt":1643277600,"width":1280,"height":720,"duration":3453,"msDuration":3453000,"id":"id","name":"GSN-LTT: Geothermal Engineering and Policy Support in Indonesia","description":"Over the past two years Arup has provided policy support to the\r\nIndonesian government to accelerate the development of geothermal power. In this talk, Mike Chendorain provides an overview of\r\ngeothermal engineering, financial planning of geothermal power projects, and\r\npolicy and stakeholder engagement aspects.<br>","partnerId":"","userId":"","creatorId":"","tags":"geothermal energy, indonesia","categories":"","categoriesIds":"","status":2,"moderationStatus":6,"moderationCount":0,"type":1,"createdAt":1495133675,"updatedAt":1556016025,"rank":0,"totalRank":0,"votes":0,"downloadUrl":"download url","searchText":"","licenseType":-1,"version":0,"thumbnailUrl":"thumbnailUrl","accessControlId":"","replacementStatus":0,"partnerSortValue":0,"conversionProfileId":7435211,"rootEntryId":"1_5gpxinot","operationAttributes":[],"entitledUsersEdit":"","entitledUsersPublish":"","entitledUsersView":"","capabilities":"","displayInSearch":1,"blockAutoTranscript":false,"objectType":"KalturaMediaEntry"}}
{
"objectType": "KalturaMediaEntry",
"name": "GSN-LTT: Geothermal Engineering and Policy Support in Indonesia",
"description": "Over the past two years Arup has provided policy support to the\r\nIndonesian government to accelerate the development of geothermal power.\u0026nbsp; In this talk, Mike Chendorain provides an overview of\r\ngeothermal engineering, financial planning of geothermal power projects, and\r\npolicy and stakeholder engagement aspects.\u003cbr\u003e",
"userId": "userId",
"creatorId": "creatorId",
"tags": "geothermal energy, indonesia",
"categories": "",
"categoriesIds": "",
"type": "1",
"licenseType": -1,
"accessControlId": "",
"partnerSortValue": 0,
"conversionProfileId": "",
"operationAttributes": {
"-": ""
},
"entitledUsersEdit": "",
"entitledUsersPublish": "",
"entitledUsersView": "",
"displayInSearch": 1,
"blockAutoTranscript": false,
"msDuration": 3453000,
"mediaType": 1,
"conversionQuality": "7435211",
"sourceType": "6"
}
Which includes the data I wanted and the identical results in python. (The first two console logs are not printed by me, the library must have them somewhere).
Looking back I feel silly for not second-guessing the printing method, but we live and learn I guess.
Thank you again,
Hope you have a great weekend!
Jamie