Api response issue

Hi everyone,

I am trying to query our Kaltura videos to look for key words in a video description and return that video’s info. I am using baseEntry.list to do this. I can get the python code to work on on the API site using their “Try It” feature. When I try to run it on my computer I get a response but I can’t figure out how to process it. Below is the response I get:

<KalturaClient.Plugins.Core.KalturaBaseEntryListResponse object at 0x00000290BED12470>

My code:
from KalturaClient import *
from KalturaClient.Plugins.Core import *
import json

config = KalturaConfiguration(2011531)
config.serviceUrl = “https://www.kaltura.com/
client = KalturaClient(config)
ks = client.session.start(
“”,
“”,
KalturaSessionType.ADMIN,
“”)
client.setKs(ks)

filter = KalturaBaseEntryFilter()
filter.descriptionLike = “2rcUutywRGu8imrEHc3WFQ==”
#filter.descriptionLike = “”
pager = KalturaFilterPager()

result = client.baseEntry.list(filter, pager)
print(result)

It should be json but python just sees it as an object. Any idea what I am missing?

Thanks for your help.

Hi Corey,

I’m using C# for Kaltura API calls, I’m not 100% up on python and Kaltura. The response isn’t JSON, as you said. That threw me for quite some time.

Python sees the result as an object. This object has a list of attributes you can query directly. You could try this code to show the attributes and values available.

# using __dict__ to access attributes
# of the object result along with their values
print(result.__dict__)
  
# to only access attributes
print(result.__dict__.keys())
  
# to only access values
print(n.__result__.values())

I found the above code here:

Got it. Hope this helps someone.

from KalturaClient import *
from KalturaClient.Plugins.Core import *
import json

config = KalturaConfiguration(2011531)
config.serviceUrl = “https://www.kaltura.com/”
client = KalturaClient(config)
ks = client.session.start(
“”,
“”,
KalturaSessionType.ADMIN,
“”)
client.setKs(ks)

filter = KalturaBaseEntryFilter()
filter.descriptionLike = “2rcUutywRGu8imrEHc3WFQ==”
#filter.descriptionLike = “”
pager = KalturaFilterPager()

result = client.baseEntry.list(filter, pager)

x = result.getObjects()

y = x[0].toParams().toJson()

print(y)

This will print out the JSON that is returned when using the API.