BingAds / BingAds-Python-SDK

Other
116 stars 162 forks source link

campaign_service.AddAds fails with exception #282

Open andreacimino opened 4 months ago

andreacimino commented 4 months ago

When using the

examples/v13/responsive_ads.py

script, in order to understand how the client library works, the script fails at the following line


    add_ads_response = campaign_service.AddAds(
            AdGroupId=ad_group_ids["long"][0], Ads=ads
        )

With the following error. I am using Python 3.12.


Web service reported a SOAP processing fault using an unexpected HTTP status code 200. Reporting as an internal server error.
Traceback (most recent call last):
  File "/home/andrea/git/BingAds-Python-SDK/examples/v13/responsive_ads.py", line 146, in main
    add_ads_response = campaign_service.AddAds(
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andrea/git/BingAds-Python-SDK/venv3/lib/python3.12/site-packages/bingads/service_client.py", line 287, in __call__
    raise ex
  File "/home/andrea/git/BingAds-Python-SDK/venv3/lib/python3.12/site-packages/bingads/service_client.py", line 279, in __call__
    response = self.service_client.soap_client.service.__getattr__(self.name)(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andrea/git/BingAds-Python-SDK/venv3/lib/python3.12/site-packages/suds/client.py", line 586, in __call__
    return client.invoke(args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andrea/git/BingAds-Python-SDK/venv3/lib/python3.12/site-packages/suds/client.py", line 728, in invoke
    result = self.send(soapenv, timeout=timeout)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andrea/git/BingAds-Python-SDK/venv3/lib/python3.12/site-packages/suds/client.py", line 777, in send
    return self.process_reply(reply.message, None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andrea/git/BingAds-Python-SDK/venv3/lib/python3.12/site-packages/suds/client.py", line 840, in process_reply
    raise WebFault(fault, replyroot)
suds.WebFault: Server raised fault: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/CampaignManagement/v13:Ads. The InnerException message was 'Error in line 1 position 3316. Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''.'.  Please see InnerException for more details.'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/andrea/git/BingAds-Python-SDK/examples/v13/responsive_ads.py", line 226, in <module>
    main(authorization_data)
  File "/home/andrea/git/BingAds-Python-SDK/examples/v13/responsive_ads.py", line 181, in main
    output_webfault_errors(ex)
  File "/home/andrea/git/BingAds-Python-SDK/examples/v13/output_helper.py", line 21, in output_webfault_errors
    raise Exception("Unknown WebFault")
Exception: Unknown WebFault