Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting exception when using location=True for get_object() #48

Open
wilson-gardner opened this issue May 24, 2019 · 2 comments
Open

Getting exception when using location=True for get_object() #48

wilson-gardner opened this issue May 24, 2019 · 2 comments

Comments

@wilson-gardner
Copy link

wilson-gardner commented May 24, 2019

photos = rets_client.get_object(
         resource='Property',
         object_type='Photo',
         resource_keys=listing_rid,
         location=True
)

The variable 'listing_rid' is a string representation of the Key Field ListingRid (already checked on retsmd). This is returning the following error:

File "property_update.py", line 13, in <module>
    add_new_properties(add_remote, client, db)
  File "/root/function_files/property_functions.py", line 77, in add_new_properties
    location=True,
  File "/root/retsvenv/lib/python3.7/site-packages/rets/http/client.py", line 283, in get_object
    return parse_object(response)
  File "/root/retsvenv/lib/python3.7/site-packages/rets/http/parsers/parse_object.py", line 26, in parse_object
    return _parse_multipart(response)
  File "/root/retsvenv/lib/python3.7/site-packages/rets/http/parsers/parse_object.py", line 64, in _parse_multipart
    multipart = MultipartDecoder.from_response(response, encoding)
  File "/root/retsvenv/lib/python3.7/site-packages/requests_toolbelt/multipart/decoder.py", line 156, in from_response
    return cls(content, content_type, encoding)
  File "/root/retsvenv/lib/python3.7/site-packages/requests_toolbelt/multipart/decoder.py", line 111, in __init__
    self._parse_body(content)
  File "/root/retsvenv/lib/python3.7/site-packages/requests_toolbelt/multipart/decoder.py", line 150, in _parse_body
    self.parts = tuple(body_part(x) for x in parts if test_part(x))
  File "/root/retsvenv/lib/python3.7/site-packages/requests_toolbelt/multipart/decoder.py", line 150, in <genexpr>
    self.parts = tuple(body_part(x) for x in parts if test_part(x))
  File "/root/retsvenv/lib/python3.7/site-packages/requests_toolbelt/multipart/decoder.py", line 141, in body_part
    return BodyPart(fixed, self.encoding)
  File "/root/retsvenv/lib/python3.7/site-packages/requests_toolbelt/multipart/decoder.py", line 64, in __init__
    'content does not contain CR-LF-CR-LF'
requests_toolbelt.multipart.decoder.ImproperBodyPartContentException: content does not contain CR-LF-CR-LF
@wilson-gardner wilson-gardner changed the title Getting empty tuple when getting object with RetsHttpClient Getting exception when using location=True for get_object() May 24, 2019
@wilson-gardner
Copy link
Author

I did figure out that when I remove location=True from the list of arguments it returns a MASSIVE amount of what I assume is binary data (aka image data). As soon as I add in location=True though, it gives me that exception.

@bruno-uy
Copy link

From the docs:

:param location: Flag to indicate whether the object or a URL to the object should be
returned. If location is set to True, it is up to the server to support this
functionality and the lifetime of the returned URL is not given by the RETS
specification.

I think it could be related to the server that doesn't support that functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants