[libRETS-users] RetsReplyException

80 views
Skip to first unread message

giov...@pellego.com

unread,
May 2, 2018, 2:05:38 PM5/2/18
to libret...@groups.realtors.org
Hi all!

I started using LibRETs for Python and I have a few questions:

Am using the Developer's Guide from GitHub
(https://github.com/NationalAssociationOfRealtors/libRETS/wiki/Developer's-Guide)
as a tutorial for getting familiar with the library. In the section 4
(Performing Searches), the following example is given:

```
request = session.CreateSearchRequest("Property", "RES",
"(ListPrice=300000-)")
result = session.Search(request)
```

But the second line yields:

```
RetsReplyException Traceback (most recent call last)
<ipython-input-33-fbe6f97a11d4> in <module>()
----> 1 session.Search(request)

/usr/local/lib/python3.6/site-packages/librets.py in Search(self, *args)
4234
4235 def Search(self, *args) -> "void":
-> 4236 return _librets.RetsSession_Search(self, *args)
4237
4238 def Logout(self) -> "LogoutResponseAPtr":

RetsReplyException: None
```

1) Is this because am creating a search request with arguments that my MLS
doesn't have? (eg, "Property", "RES", "ListPrice")
2) Should I get the valid arguments from the MetadataLookup? (Section 3)

I'm probably mixing things regarding questions 1) & 2), that's because I don't
understand very much of it.

Thanks,
Giovannni

Rob Overman

unread,
May 2, 2018, 2:30:29 PM5/2/18
to libret...@groups.realtors.org
Hi Giovanni,

Actually 1 and 2 are directly related. The metadata will tell you the correct Resource, Class and searchable fields for the RETS server you are querying. 

Check the metadata. "Property" is likely correct for the Resource but the Class names may be different. The field for list price may also be different.

Rob

giov...@pellego.com

unread,
May 2, 2018, 3:40:55 PM5/2/18
to libret...@groups.realtors.org
Great, thanks!

I was able to make a request getting the arguments from the metadata, just as
you suggested, but am getting something I can't catch:

request = session.CreateSearchRequest("Property", "CLR", "(SalePrice=1+)")
res = session.Search(request)

That request got 1414 hits, but when I do

res.GetColumns()

I get an empy tuple. Just as res.HasNext() returns False.

Does this mean that that table is not populated yet? Am I missing some other
step?

Thanks,
G.

Mike Sparr

unread,
May 3, 2018, 1:37:57 AM5/3/18
to libret...@groups.realtors.org
Different RETS servers require more than one field in query. Rapattoni comes to mind but you likely wouldn’t get results.

I use generator in Python and query like this:

image1.png

giov...@pellego.com

unread,
May 3, 2018, 11:58:07 AM5/3/18
to libret...@groups.realtors.org
Yeah, that didn't seem to be the problem, since the following code

req = session.CreateSearchRequest("Property", "CMF", "(YearBuilt=1+) ,
(ListingStatus=|1,2)")
res = session.Search(req)

yields 438 hits (res.GetCount()), but res.GetColumns() keeps returning an
empty tuple. I don't know what else to try.

Also, it seems that the domain www.crt.realtors.org doesn't exist anymore,
does anybody know where it moved?

Thanks,
Giovanni

Rob Overman

unread,
May 3, 2018, 2:21:04 PM5/3/18
to libret...@groups.realtors.org
Most of the content that was on CRT's server is gone. You've seen whatever was saved on GitHub.

Try this...

                req = session.CreateSearchRequest("Property", "CMF", "(YearBuilt = 1 +),(ListingStatus =| 1, 2)");
                req.SetSelect("ListingStatus,YearBuilt");   // this sets the fields to return
                res = session.Search(req);


Giovanni Rescia

unread,
May 3, 2018, 3:47:00 PM5/3/18
to libret...@groups.realtors.org
Didn't work, maybe it's a problem with the Python binding?

Carl Edwards

unread,
May 3, 2018, 4:40:07 PM5/3/18
to libret...@groups.realtors.org
I'm using .NET but initially found it non-intuitive that I had to start the iteration of the results before I could get the list of columns:


using (SearchRequest searchRequest = session.CreateSearchRequest("Property", "PRIV", "(LN=*)")) {

       //  set additional searchRequest options here       

       using (SearchResultSet results = session.Search(searchRequest)) {

                        IEnumerable<string> columns = null;
                        while (results.HasNext()) {

                             if (columns == null)
                                 columns = results.GetColumns();

                             // process columns
                        }
       }
}



/Carl

Carl Edwards
Aumnia, Inc
805.910.7844
ca...@aumnia.com

Kenny Cubas

unread,
May 3, 2018, 4:53:51 PM5/3/18
to libret...@groups.realtors.org

Do you have this in your code(green line)? (could be a default value, but try it)

 

                req = session.CreateSearchRequest("Property", "CMF", "(YearBuilt=1+),(ListingStatus =|1, 2)");

                req.SetSelect("ListingStatus,YearBuilt");   // this sets the fields to return

req.SetCountType(SearchRequest.CountType.RECORD_COUNT_AND_RESULTS);

                res = session.Search(req);

 

 

Thanks




CONFIDENTIALITY: This email (including any attachments) may contain confidential, proprietary
and privileged information, and unauthorized disclosure or use is prohibited. If you received this
email in error, please notify the sender and delete this email from your system.

Rob Overman

unread,
May 3, 2018, 5:08:17 PM5/3/18
to libret...@groups.realtors.org
I am comparing this against two different RETS servers and have also tried Kenny and Carl's suggestions.

CoreLogic Matrix RETS server is not working for me using any of the suggestions for far. Giovanni, is it a mlsmatrix.com server URL?

I've tried against another server that I think may be Variman and it works perfectly there.

Rob Overman

unread,
May 3, 2018, 5:33:52 PM5/3/18
to libret...@groups.realtors.org
IMPORTANT!!!

It appears that Matrix requires

req.SetFormatType(SearchRequest.FormatType.COMPACT_DECODED)

rather than whatever default libRETS uses. 

According to the 1.7.2. spec, this should be optional but Matrix is requiring it.


Giovanni Rescia

unread,
May 4, 2018, 8:32:11 AM5/4/18
to libret...@groups.realtors.org
Thank you all for your support,

I tried what Kenny suggested and didn't work. But what Rob said, made it work! In Python, that line is

req.SetFormatType(librets.SearchRequest.COMPACT_DECODED)


>> Giovanni, is it a mlsmatrix.com server URL?

No, it's another server.

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