FuelSDK-Python icon indicating copy to clipboard operation
FuelSDK-Python copied to clipboard

Suds library for any SOAP request using FuelSDK creates an humongous object

Open ZMI-YohanandGopal opened this issue 10 years ago • 3 comments

We are trying to run the calls found under https://code.exacttarget.com/apis-sdks/fuel-sdks/index.html. I am using the python examples from the website and using the below version of the libraries to send request to exact target

  • PyJWT=0.1.9 (jwt)
  • distribute=0.7.3
  • requests=2.2.1
  • suds=0.4
  • wsgiref=0.1.2
  • FuelSDK=0.9.3
  • As per our investigation we are seeing the below behavior:

Create of SOAP message by the FuelSDK takes a constant 10- 15 seconds.

File: suds/client.py Function: create() which is called in FuelSDK/rest.py::auth_stub.soap_client.service.create(None, self.parse_props_into_ws_object(auth_stub, obj_type, props)), in turn calls the build().

File: suds/builder.py: build() creates a “data” object which is more than 19000 lines. This is what is causing the delay, but we don’t control both FuelSDK and suds library. Are we doing something wrong?

• We have set our AUTH_URL legacy parameter as 1, is it causing the issue? Legacy set to 0 is not working for us as it is throwing a “KeyError: 'legacyToken'”. Our config setting:

os.environ["FUELSDK_AUTH_URL"] = "https://auth.exacttargetapis.com/v1/requestToken?legacy=1"

I have tried this in multiple vm's and all of them are behaving the same way.

Any help will be appreciated.

ZMI-YohanandGopal avatar Jul 27 '15 13:07 ZMI-YohanandGopal

This is inline with the experience I'm having as well. It appears the calls and response walks the full object as defined in the wsdl from your parent object to it's child object (repeating with the child as the new parent, ad infinitum) regardless of the need for those child elements.

I haven't done any level of investigation as our scale of implementation hasn't required increased performance. I would love to hear others thoughts on this isssue.

BrianEdwardHoover avatar Jul 27 '15 13:07 BrianEdwardHoover

I am also experiencing the same issue. Is there any solution or workaround for this.

mastanbol avatar Oct 17 '18 11:10 mastanbol

Inelegant and probably a terrible solution, but here's how I "fixed" it in our code:

from suds.builder import Builder

old_skip_child = Builder.skip_child


def new_skip_child(self, child, ancestry):
    # the salesforce wsdl has an infinite recursion; cap it off at 4 to make it faster
    # on a macbook pro, 15 seconds to 600ms spent on building the object
    if len(ancestry) > 4:
        return True

    return old_skip_child(self, child, ancestry)

Builder.skip_child = new_skip_child

josephdrose avatar Oct 30 '18 20:10 josephdrose