salesforce-marketingcloud / FuelSDK-Python

FuelSDK for python
Other
126 stars 193 forks source link

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

Open ZMI-YohanandGopal opened 9 years ago

ZMI-YohanandGopal commented 9 years ago

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

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.

BrianEdwardHoover commented 9 years ago

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.

mastanbol commented 5 years ago

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

josephdrose commented 5 years ago

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