[libRETS-users] Getting a photo

30 views
Skip to first unread message

giov...@pellego.com

unread,
May 15, 2018, 11:14:15 AM5/15/18
to libret...@groups.realtors.org
Hi everyone again!

I am trying to fetch some photos following again the developer's guide
(https://github.com/NationalAssociationOfRealtors/libRETS/wiki/Developer%27s-Guide#5fetching-media).

This is my Python code:

request = librets.GetObjectRequest("Property", "Photo")
# this is the property id, which I know it has photos
request.AddAllObjects('1313')
response = session.GetObject(request)
object_descriptor = response.NextObject()
while (object_descriptor != None):
object_key = object_descriptor.GetObjectKey()
object_id = object_descriptor.GetObjectId()
content_type = object_descriptor.GetContentType()
description = object_descriptor.GetDescription()
print (object_key + " object #" + str(object_id))
output_file_name = object_key + "-" + str(object_id) + ".jpg"
print(output_file_name)
object_descriptor = response.NextObject()

The problem is that am getting empy values, the print statements prints:

object #0
-0.jpg

No object key is returned, what am I missing?

Cheers,
Giovanni
Reply all
Reply to author
Forward
0 new messages