Git Product home page Git Product logo

bingads-python-sdk's Introduction

Bing Ads Python SDK

The Bing Ads Python Software Development Kit (SDK) Version 13.0 enhances the experience of developing Bing Ads applications with the Python programming language. The SDK includes proxy classes for all Bing Ads API web services and abstracts the low level details of authentication with OAuth. You can also read and write bulk files with the SDK BulkFileReader and BulkFileWriter, and use the high level BulkServiceManager interface to abstract and execute operations in the low level Bulk API. For more information, see Bing Ads Client Libraries.

Getting Started

To get started developing Bing Ads applications with Python, install the SDK and either start with the examples or follow one of the application walkthroughs. For more information, see Getting Started Using Python with Bing Ads Services.

External Dependencies

bingads-python-sdk's People

Contributors

clynch00 avatar eric-urban avatar freiz avatar imagineful avatar jianyunzhao avatar nilya avatar pturegano avatar qitia avatar vishaljaishankar avatar xinyuwen2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bingads-python-sdk's Issues

pip install bingads gettting error

Trying to install bingads with pip install and getting that error:

C:\Users\a>pip install --upgrade bingads

Downloading/unpacking bingads
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement bingads
Cleaning up...
No distributions at all found for bingads
Storing debug log for failure in C:\Users\a\pip\pip.log

Please fix

Thanks!

Frustration after frustation

Sorry this is going to be a long rant. ๐Ÿ˜ 

Microsoft really needs to take a deep look at themselves:

What was supposed to be a very simple requirement:

  • Automate a Keyword report via API

"Sure, no problem Bing Ads seems to have an api" ~ famous last words.. ยฏ\_(ใƒ„)_/ยฏ

image

And so became week plus of torture. Now to be fair Google Adwords is worse, but thats fine they have probably 90% market share so they can "afford" to be smug.

Ultimately an api is just a FFI (Foreign Function Interface) and as such all that it should boil down to is:

  • A simple list of remote functions
  • A list of parameters types to those said functions
  • A description of the return payload type
  • Some simple authenticate mechanism.

But of course big enterprises software has to be 3,000 tons of fresh manure because naturally enterprise software has to always be made as complex and ridiculous as humanly possible: how else are we to justify all those man hours?

The documentation is a horrendous labyrinth of indirection, coupled with a stupid process equals many hours of pointless waste.

The "Chat Support" those poor souls have to take the brunt of abuse from hoards of frustrated developers but bless them they do try their best!

The "Support Team" phone calls was a pure nugget of comic genius:

I phoned in, clearly this was a VOIP line that must have been routed via a 24k MODEM that or someone in communications should be fired for using G711 with 500+ms latency. The IVR was just terrible, in the first round I managed to get through to an actual human only to have my line dropped. The next 10 attempts all failed as the IVR simply could not pickup the numbers that I pressed, which doesn't surprise me, they probably didn't follow proper RFC-4733 and the DTMF tones are probably being passed in band :|

Frustrated I turned back to chat, who after a lengthly conversation said that I needed to pass them detailed information which they will then pass onto the "engineers", great something that could probably be solved just by speaking directly to a tech bod now has to have this stupid three way communication ping pong :(

image

Frustration after frustration

OK so after a week plus, what have I managed to do?

  • Setup myriad of accounts, apps and other pointless registrations
  • Get a "multi-user" token, because [insert retarded reason]
  • Use massively bloated over engineered OAuth 2.0 "flow" garbage (tm) mechanism
  • Actually get the samples to run :|
  • Survive not killing support with a frozen cucumber
  • Actually download Keyword report :`(

You know both documentation and api do not have to be burning mountains of feces. We could have a world where api's are simple, functional and beautiful:

"you may say I'm a dreamer, but I'm not the only one"

MethodNotFound Exception for CampaignManagementService

Hello,

I am getting the following error *** MethodNotFound: Method not found: 'CampaignManagementService.BasicHttpBinding_ICampaignManagementService.__repr__' when trying to get a CampaignManagementService.
The troublesome code being used is this:

def _build_campaign_service(self, account_id, customer_id):
        authorization_data = AuthorizationData(
            developer_token=BING_DEVELOPER_TOKEN,
            authentication=self.authentication,
            account_id=account_id,
            customer_id=customer_id,
        )

        campaign_service = ServiceClient(
            'CampaignManagementService',
            authorization_data=authorization_data,
            environment=BING_ENVIRONMENT
        )

        return campaign_service

All parameters for the call seem to be populated correctly.
One more weird thing is that the only output I get is No handlers could be found for logger "suds.client", nothing else, and the application just hangs at that point. The only way I could see the error was by using ipdb.set_trace()

     266         campaign_service = ServiceClient(
     267             'CampaignManagementService',
     268             authorization_data=authorization_data,
     269             environment=BING_ENVIRONMENT
     270          )
     271
--> 272        return campaign_service

ipdb> campaign_service
*** MethodNotFound: Method not found: 'CampaignManagementService.BasicHttpBinding_ICampaignManagementService.__repr__'

I do not know where to start debugging the issue, any pointers would be greatly appreciated!

Proxy Issue

Hi there,

I'm running into an issue as I'm behind a corp proxy. I'm trying to generate reports using the ReportingService feature. I've been passing the proxy as follows when constructing ReportingServiceManager and ServiceClient as so:

reporting_service_manager=ReportingServiceManager(
        authorization_data=authorization_data, 
        poll_interval_in_milliseconds=5000, 
        environment=ENVIRONMENT,
        proxy={'https': 'user:[email protected]:1234'}
    )

 reporting_service=ServiceClient(
        'ReportingService', 
        authorization_data=authorization_data, 
        environment=ENVIRONMENT,
        version=9,
        proxy={'https': 'user:[email protected]:1234'}
    )

This will pass the proxy input to the SUDS Client in the background so the call can be made. Makes sense and works as it should.

the problem occurs when making the submit_download request and the subsequent pooling which occurs when a call is made to the ReportingDownloadOperation class.

The ReportingDownloadOperation class takes the **suds_options in the constructor to pass to the ServiceClient which is great but it seems like the proxy setting are never passed in the following line of code.

https://github.com/BingAds/BingAds-Python-SDK/blob/master/bingads/reporting/reporting_service_manager.py#L91

Is there a work around for this that I'm missing?
If I hack the code base a bit I can get it to work like this

def submit_download(self, report_request, http_proxy):
        """ Submits a download request to the Bing Ads reporting service with the specified request.
        :param report_request: Determines what kind of reporting file to download
        :type report_request: ReportRequest
        :return: The submitted download operation
        :rtype: ReportingDownloadOperation
        """
        response = self.service_client.SubmitGenerateReport(report_request)
        operation = ReportingDownloadOperation(
            request_id=response,
            authorization_data=self._authorization_data,
            poll_interval_in_milliseconds=self._poll_interval_in_milliseconds,
            environment=self._environment,
            location=self.service_client.service_url,
            proxy=http_proxy
        )
        return operation

Without this I can never get past the proxy and download the file. It works if I'm not behind a proxy.
I feel like the submit_download method would benefit from a **suds_options kwarg too maybe?

Thanks,
Faisal

authorization.py - line 400

oauth_web_auth_code_grant.request_oauth_tokens_by_response_uri sends out a the client secret with the post request, causing the following error:

OAuthTokenRequestException: error_code: invalid_request, error_description: Public clients can't send a client secret.

Solution - remove the client_secret parameter from this request at authorization.py:400

Get the user_id from OAuthTokens

Hi,

I need the _UriOAuthService.get_access_token method to return an OAuthTokens with the user_id in it.

Bing service returns the user_id, but the OAuthTokens class doesn't have an user_id attribute.

Can you add the user_id to the OAuthTokens class ?
Or is another way were I can get the user_id ?

Question: how can I cache an access_token?

Hi,

I'm using the api in a command line script - but every time I run it it refreshes the refresh token and gets a new access token (I'm using the example code) - I don't see a reason for it, since I already have an access token that can hold (for example) for an hour after I run it once. Is there a way to create authentication and initialize it with an access_token and refresh_token (to be used when the access_token has expired)?

For example, I can manage to do this via undocumented property:

    authentication = OAuthDesktopMobileAuthCodeGrant(
        client_id = CLIENT_ID
    )
    refresh_token = get_refresh_token()
    access_token = get_access_token()

    authentication._oauth_tokens = OAuthTokens(access_token, int(3600), refresh_token);

It works pretty well, and all the services refresh the token if necessary.
The access token has to be saved at the refresh callback, similar to the example code.

Critical: SDK still not compatible with V11

On September 31 the API services for V9/V10 will be shut down - only 3 weeks to left.
https://blogs.msdn.microsoft.com/bing_ads_api/2017/09/29/30-day-reminder-migrate-to-api-v11/

But this SDK is still not compatible to V11!

The problem are two hardcoded lines in the code where V9 is used instead of v11.

bingads/reporting/reporting_operation.py on line 56:
self._service_client = ServiceClient('ReportingService', authorization_data, environment, 9, **suds_options)

Change to:
self._service_client = ServiceClient('ReportingService', authorization_data, environment, 11, **suds_options)

bingads/reporting/reporting_service_manager.py on line 39:
self._service_client = ServiceClient('ReportingService', authorization_data, environment, 9, **suds_options)

Change to:
self._service_client = ServiceClient('ReportingService', authorization_data, environment, 11, **suds_options)

However this is just a dirty quickfix. The used version should not be hardcoded here.

GetCampaignsByAccountId on sandbox environment keep throwing 119 error code

After a successful user/pass authentication and having instantiated the campaign_service, I get the user's account list through the SearchAccounts method and store the list in variable accounts.

Then I define this:

def get_campaigns_by_account_id(self, account_id=None):
    return self.campaign_service.GetCampaignsByAccountId(
        AccountId=account_id,
        CampaignType="SearchAndContent"
    )

calling it in this way:

campaigns = bing_client.get_campaigns_by_account_id(accounts[0].Id)

This is the request:

<SOAP-ENV:Envelope xmlns:ns0="https://bingads.microsoft.com/CampaignManagement/v11" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://bingads.microsoft.com/CampaignManagement/
v11" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
      <tns:CustomerAccountId>None</tns:CustomerAccountId>
      <tns:CustomerId>None</tns:CustomerId>
      <tns:DeveloperToken>BBD37VB98</tns:DeveloperToken>
      <tns:Password>XXXXXXXX</tns:Password>
      <tns:UserName>XXXXXXXX</tns:UserName>
   </SOAP-ENV:Header>
   <ns1:Body>
      <ns0:GetCampaignsByAccountIdRequest>
         <ns0:AccountId>123456789</ns0:AccountId>
         <ns0:CampaignType>SearchAndContent</ns0:CampaignType>
      </ns0:GetCampaignsByAccountIdRequest>
   </ns1:Body>
</SOAP-ENV:Envelope>

... and this is the response I get:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Server</faultcode><faultstring xml:lang="en-US">Invalid client data. Check the SOAP fault details for more information</faultstring><detail><AdApiFaultDetail
xmlns="https://adapi.microsoft.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><TrackingId>953b79f7-3881-4fdc-a24c-4051fb2936bc</TrackingId><Errors><AdApiError><Code>119</Code><Detail i:nil="true"/><ErrorCode>InvalidAccountId</ErrorCode><Messa
ge>The account ID is invalid.</Message></AdApiError></Errors></AdApiFaultDetail></detail></s:Fault></s:Body></s:Envelope>

For sure the AccountId isn't really 123456789, instead is the one returned by SearchAccounts, equals to the aid query param I see in the browser URL bar when I navigate the Bing Ads console.

Am I missing something?

Thank you

Issue with ad distribution column for bing campaigns reporting data

Hi Team,

we are facing an issue with the reporting data related to four campaigns in particular for our camapign section end point.
There is this column called Addistribution which should have 'Search' or 'Content' or 'Native' but we are getting a new value named 'Audience'. This cannot be an appropriate value for ad distribution as far as we understand.

Can you confirm on this once pls?

we are noticing this value for four of our campaigns. Happy to have a session to discuss on this.
If it is a valid value we need to change our ETL logic to facilitate the same. Kindly confirm on the same.

Error: requests.exceptions.ConnectionError: Max retries exceeded with url: /ReportDownload/Download.aspx...

Hi,

once in a while I get the following error while using the bulk service (similar code to the provided example) to get keywords (it also happens with other entities):

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='download.api.bingads.microsoft.com', port=443): Max retries exceeded with url: /ReportDownload/Download.aspx?q=<obscurified> (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7c2d6ef210>: Failed to establish a new connection: [Errno -2] Name or service not known',))

----- Python Traceback -----
File "<obscurified>", line <obscurified>, in <module>
  background_completion(reporting_download_parameters)
File "<obscurified>", line <obscurified>, in background_completion
  result_file_path = reporting_service_manager.download_file(reporting_download_parameters)
File "/usr/local/lib/python2.7/dist-packages/bingads/reporting/reporting_service_manager.py", line 65, in download_file
  overwrite=download_parameters.overwrite_result_file,
File "/usr/local/lib/python2.7/dist-packages/bingads/reporting/reporting_operation.py", line 103, in download_result_file
  r = s.get(url, headers=headers, stream=True, verify=True)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 480, in get
  return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
  resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
  r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 437, in send
  raise ConnectionError(e, request=request)

sometimes I get similar error, but it in different places within the SDK

  File "<obscurified>", line <obscurified>, in background_completion
    result_file_path = reporting_service_manager.download_file(reporting_download_parameters)
  File "/usr/local/lib/python2.7/dist-packages/bingads/reporting/reporting_service_manager.py", line 57, in download_file
    operation.track()
  File "/usr/local/lib/python2.7/dist-packages/bingads/reporting/reporting_operation.py", line 135, in track
    status = self.get_status()
  File "/usr/local/lib/python2.7/dist-packages/bingads/reporting/reporting_operation.py", line 153, in get_status
    response = self.service_client.PollGenerateReport(self.request_id)
  File "/usr/local/lib/python2.7/dist-packages/bingads/service_client.py", line 269, in __call__
    raise ex

From what I understand the server says it gets too many requests. It might be worth to catch this exception, sleep, and try again within the SDK. It can be done from the outside but then a new request will be generated for no reason.

Report Request does not download result file

I successfully started using the python SDK, using it to pull performance reports using the example code provided here on GitHub. I am using the report_request.py example. I had been using it daily since the beginning of December with no issues. However, on January 1, everything stopped working with no changes to the code, and I have not been successful since then.

It appears to get through the creation of the report request, but seems to fail on the submit and download,

The output from running the report_requests.py:
runfile('Y:/report_requests.py', wdir='Y:/')
Python loads the web service proxies at runtime, so you will observe a performance delay between program launch and main execution...

Awaiting Background Completion . . .
Download result file: None

Awaiting Submit and Download . . .
Download result file: None

Awaiting Download Results . . .
Download result file: None
Status: Success

Program execution completed

campaign_service.GetKeywordsByAdGroupId not working

Hi, I keep getting errors when call this function:

In [284]: response = campaign_service.GetKeywordsByAdGroupId(AdGroupID=adgroup_id, ReturnAdditionalFields=["InheritedBidStrategyType"])
---------------------------------------------------------------------------
WebFault                                  Traceback (most recent call last)
<ipython-input-284-062a07c83cc9> in <module>()
----> 1 response = campaign_service.GetKeywordsByAdGroupId(AdGroupID=adgroup_id, ReturnAdditionalFields=["InheritedBidStrategyType"])

/usr/local/lib/python2.7/dist-packages/bingads/service_client.pyc in __call__(self, *args, **kwargs)
    267                 self.service_client.set_options(**self.service_client._options)
    268             try:
--> 269                 response = self.service_client.soap_client.service.__getattr__(self.name)(*args, **kwargs)
    270                 return response
    271             except Exception as ex:

WebFault: Server raised fault: 'Invalid client data. Check the SOAP fault details for more information'

where adgroup_id is a valid integer for ad_group_id, and the value of ReturnAdditionalFields follows the xml schema defined here:
https://docs.microsoft.com/en-us/bingads/campaign-management-service/keywordadditionalfield?view=bingads-11

The API doc for function GetKeywordsByAdGroupId is here:
https://docs.microsoft.com/en-us/bingads/campaign-management-service/getkeywordsbyadgroupid?view=bingads-11

Since the error seems from serving side, I don't have any insight about the actual exception. But when I try to pass in a random ReturnAdditionalFields value, I got a different error:

In [285]: response = campaign_service.GetKeywordsByAdGroupId(AdGroupID=adgroup_id, ReturnAdditionalFields=["mehh"])
---------------------------------------------------------------------------
WebFault                                  Traceback (most recent call last)
<ipython-input-285-49077c63d314> in <module>()
----> 1 response = campaign_service.GetKeywordsByAdGroupId(AdGroupID=adgroup_id, ReturnAdditionalFields=["mehh"])

/usr/local/lib/python2.7/dist-packages/bingads/service_client.pyc in __call__(self, *args, **kwargs)
    267                 self.service_client.set_options(**self.service_client._options)
    268             try:
--> 269                 response = self.service_client.soap_client.service.__getattr__(self.name)(*args, **kwargs)
    270                 return response
    271             except Exception as ex:

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/v11:ReturnAdditionalFields. The InnerException message was 'Invalid enum value 'mehh' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V11.KeywordAdditionalField'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'.  Please see InnerException for more details.'

So I started to think that might be the authentication issue, but I've followed all the steps in the doc to authenticate by the develop token, and all the other API services work. Here is the flow of my code:

def get_client_config(marketer_account):
    # returns all the config needed for authenticate

def authenticate(authorization_data, customer_service, marketer_account, client_id):
    authentication = OAuthDesktopMobileAuthCodeGrant(client_id=client_id)
    authorization_data.authentication = authentication

    # callback function only takes 1 argument
    authorization_data.authentication.token_refreshed_callback = lambda x: save_refresh_token(marketer_account, x)
    refresh_token = get_refresh_token(marketer_account)
    authorization_data.authentication.request_oauth_tokens_by_refresh_token(refresh_token)

    user = customer_service.GetUser(None).User
    accounts = search_accounts_by_user_id(customer_service, user.Id)
    authorization_data.account_id = accounts['Account'][0].Id
    authorization_data.customer_id = accounts['Account'][0].ParentCustomerId

def main():
    client_config = get_client_config(marketer_account)

    authorization_data = AuthorizationData(
        account_id=None,
        customer_id=None,
        developer_token=client_config['developer_token'],
        authentication=None,
    )
    customer_service = ServiceClient(
        service='CustomerManagementService',
        authorization_data=authorization_data,
        environment=ENVIRONMENT,
        version=11,
    )

    bulk_service_manager = BulkServiceManager(
        authorization_data=authorization_data, 
        poll_interval_in_milliseconds=5000, 
        environment=ENVIRONMENT,
    )

    authenticate(authorization_data, customer_service, marketer_account, client_config['client_id'])

    campaign_service = ServiceClient(
        service='CampaignManagementService',
        authorization_data=authorization_data,
        environment=ENVIRONMENT,
        version=11,
    )
    adgroup_id = XXXXX
    response = campaign_service.GetKeywordsByAdGroupId(AdGroupId=adgroup_id, ReturnAdditionalFields=["InheritedBidStrategyType"])

environment: python2.7, bingads (11.5.4), suds (0.4), suds-jurko (0.6)

ImportError: No module named bulk

Following the Python SDK link, I installed the bingads package using sudo pip install on my ubuntu trusty (14.04) LTS machine. However, when I try to import the bingads module, it gives the below error:

>>> import bingads
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bingads.py", line 2, in <module>
    from bingads.bulk import *
ImportError: No module named bulk

Here is the output of pip list|grep bingads:

bingads (10.4.1)

ReportRequest invalid enum value ''

I keep getting

E                       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/Reporting/v11:ReportRequest. The InnerException message was 'Invalid enum value '' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Enum.ReportTimePeriod'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'.  Please see InnerException for more details.'

when trying to download AdPerformanceReport (this is a sandbox call).

this is (an excerpt of what I believe are relevant parts) of my request

   
   Aggregation = "Daily"
   Columns =
      (ArrayOfAdPerformanceReportColumn){
         AdPerformanceReportColumn[] =

            "AccountName",
... shortened for clarity
            "Path1",
            "Path2",,
      }
   Filter =
      (AdPerformanceReportFilter){
         AccountStatus = None
         AdDistribution = None
         AdGroupStatus = None
         AdStatus = None
         AdType = None
         CampaignStatus = None
         DeviceType = None
         LanguageCode =
            (ArrayOfstring){
               string[] = <empty>
            }
      }
   Scope =
      (AccountThroughAdGroupReportScope){
         AccountIds =
            {
               long[] =
                  None,
            }
         AdGroups = None
         Campaigns = None
      }
   Time =
      (ReportTime){
         CustomDateRangeEnd =
            (Date){
               Day = 11
               Month = 10
               Year = 2017
            }
         CustomDateRangeStart =
            (Date){
               Day = 10
               Month = 10
               Year = 2017
            }
         PredefinedTime =
            (ReportTimePeriod){
               value = None
            }
      }
 }

I think the problem is that PredefinedTime is appended to the request despite CustomDateRangeStart/End is set. Could that be a problem?

When I submit requests specifying only PredefinedTime, it works ok

Issue after Upgrade to v11.12.4

Hi,

We are seeing this below issue after we upgraded the SDK to 11.12.14.

from bingads.v11.bulk import *
File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/init.py", line 11, in
from .file_reader import *
File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/file_reader.py", line 2, in
from .entities.bulk_entity import BulkEntity
File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/entities/init.py", line 4, in
from .common import *
File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/entities/common.py", line 1, in
from bingads.v11.internal.bulk.string_table import _StringTable
File "/usr/local/lib/python2.7/dist-packages/bingads/v11/internal/init.py", line 4, in
from .extensions import *
File "/usr/local/lib/python2.7/dist-packages/bingads/v11/internal/extensions.py", line 42, in
TargetSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V11.create('TargetSetting'))
File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 218, in create
raise TypeNotFound(name)
suds.TypeNotFound: Type not found: 'TargetSetting''''

suds.TypeNotFound: Type not found: 'CalloutAdExtension'

I tried to upgrade from 10.4.1 to 10.4.4 and I got to following error (happens also in 10.4.2)

from bingads.v10.bulk import *
  File "/usr/local/lib/python2.7/site-packages/bingads/v10/bulk/__init__.py", line 11, in <module>
    from .file_reader import *
  File "/usr/local/lib/python2.7/site-packages/bingads/v10/bulk/file_reader.py", line 2, in <module>
    from .entities.bulk_entity import BulkEntity
  File "/usr/local/lib/python2.7/site-packages/bingads/v10/bulk/entities/__init__.py", line 17, in <module>
    from .ad_extensions import *
  File "/usr/local/lib/python2.7/site-packages/bingads/v10/bulk/entities/ad_extensions/__init__.py", line 8, in <module>
    from .bulk_callout_ad_extensions import *
  File "/usr/local/lib/python2.7/site-packages/bingads/v10/bulk/entities/ad_extensions/bulk_callout_ad_extensions.py", line 9, in <module>
    _CalloutAdExtension = type(_CAMPAIGN_OBJECT_FACTORY_V10.create('CalloutAdExtension'))
  File "/usr/local/lib/python2.7/site-packages/bingads/service_client.py", line 341, in _create_with_cache
    self.object_cache[name] = self.create_without_cache(name)
  File "/usr/local/lib/python2.7/site-packages/suds/client.py", line 218, in create
    raise TypeNotFound(name)
suds.TypeNotFound: Type not found: 'CalloutAdExtension'

after running

from bingads.v10.bulk import *

Missing Support for Reporting Service v11 (and Report Request Parameter ExcludeReportHeader)

I attempted to use the ExcludeReportHeader parameter of the Report Request object as described here:
https://msdn.microsoft.com/en-us/library/bing-ads-reporting-bing-ads-reportrequest.aspx

When I attempt to use this via something like "report_request.ExcludeReportHeader = True" an Exception (TypeNotFound).

Digging in, it seems the Reporting Service is limited to version 10 and this feature, according to the article, is only available in v11. If I attempt to set the version to 11, I get the following error:

"ValueError: version error: [11] is not supported."

This limit appears to be hard-coded in bingads/service_client.py in the method "_format_version"

DeleteCampaignsRequest type error, refuses long as CampaignId argument

I'm trying to delete some campaigns in the sandbox environment. I'm getting a conflict with the namespaces and suds while using the factory to generate a list of campaigns ids to send in the request.

envelope with namespaces:

snippet of soap body with fake values:

      <ns1:DeleteCampaignsRequest>
         <ns1:AccountId>098765</ns1:AccountId>
         <ns1:CampaignIds>
            <ns2:long>123456</ns2:long>
         </ns1:CampaignIds>
      </ns1:DeleteCampaignsRequest>
   </ns0:Body>

snippet of code used to generate the arguments:

campaign_ids = client.factory.create('CampaignIds')
campaign_ids.long.append(123456)

soap fault:

   faultcode = "a:DeserializationFailed"
   faultstring = "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/v12:CampaignIds. The InnerException message was 'There was an error deserializing the object of type System.Int64[]. End element 'CampaignIds' from namespace 'https://bingads.microsoft.com/CampaignManagement/v12' expected. Found element 'ns2:long' from namespace 'http://schemas.datacontract.org/2004/07/System'. Line 1, position 1809.'.  Please see InnerException for more details."
   detail = 
      (detail){
         ExceptionDetail = 
            (ExceptionDetail){
               HelpLink = None
               InnerException = 
                  (InnerException){
                     HelpLink = None
                     InnerException = 
                        (InnerException){
                           HelpLink = None
                           InnerException = None
                           Message = "End element 'CampaignIds' from namespace 'https://bingads.microsoft.com/CampaignManagement/v12' expected. Found element 'ns2:long' from namespace 'http://schemas.datacontract.org/2004/07/System'. Line 1, position 1809."
                           StackTrace = "   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowEndElementExpected(XmlDictionaryReader reader, String localName, String ns)
   at System.Xml.XmlBaseReader.ReadEndElement()
   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)"
                           Type = "System.Xml.XmlException"
                        }
                     Message = "There was an error deserializing the object of type System.Int64[]. End element 'CampaignIds' from namespace 'https://bingads.microsoft.com/CampaignManagement/v12' expected. Found element 'ns2:long' from namespace 'http://schemas.datacontract.org/2004/07/System'. Line 1, position 1809."
                     StackTrace = "   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)"
                     Type = "System.Runtime.Serialization.SerializationException"
                  }
               Message = "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/v12:CampaignIds. The InnerException message was 'There was an error deserializing the object of type System.Int64[]. End element 'CampaignIds' from namespace 'https://bingads.microsoft.com/CampaignManagement/v12' expected. Found element 'ns2:long' from namespace 'http://schemas.datacontract.org/2004/07/System'. Line 1, position 1809.'.  Please see InnerException for more details."
               StackTrace = "   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)"
               Type = "System.ServiceModel.Dispatcher.NetDispatcherFaultException"
            }
      }
 }

According to the shopping campaign example, this should work. However, the fault says the argument must be of type CampaignId from namespace "https://bingads.microsoft.com/CampaignManagement/v12" and the reference documentations says it must be a long from namespace "http://schemas.microsoft.com/2003/10/Serialization/Arrays".

Can you please confirm the expected type and correct the documentation?
Thanks.

Support --no-binary :all: installation for python 3.6+

Trying to install this package with no-binary :all: on python 3.6 fails with

Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 6, in <module>
        import distutils.core
      File "/usr/local/lib/python3.6/distutils/core.py", line 16, in <module>
        from distutils.dist import Distribution
      File "/usr/local/lib/python3.6/distutils/dist.py", line 9, in <module>
        import re
      File "/usr/local/lib/python3.6/re.py", line 142, in <module>
        class RegexFlag(enum.IntFlag):
    AttributeError: module 'enum' has no attribute 'IntFlag'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-nm97xwnn/enum34/

enum34 is incompatible with python 3.6+. The wheel still works for some reason.

I think this can be solved easily by making use of environment markers in setup.py install_requires to only install enum34 for python versions <=3.4. Basically, this:

'enum34',

Would become
'enum34;python_version<="3.4"',.

I can do a pull request if it helps.

Thanks!

KeyError: 'refresh_token'

Hello,

request_oauth_tokens_by_refresh_token fails with

    return OAuthTokens(r_json['access_token'], int(r_json['expires_in']), r_json['refresh_token'])
KeyError: 'refresh_token'

because the response from https://login.live.com/oauth20_token.srf is missing the refresh_token (but includes all the other fields correctly: token_type, expires_in, scope, access_token, user_id)

It started happening recently.

Could be related: https://stackoverflow.com/questions/49016329/microsoft-oauth-2-0-missing-refresh-token-field

Bing version 12

We have installed this version of Bing python SDK and running our jobs. bingads==11.12.4.

How do I make sure I am not making calls to API v.11 and only to v.12?

Report Columns are Misaligned

In the request, I have to specify a column called TimePeriod then the report returns a column called GregorianDate.

Same thing with countryorregion

suds.MethodNotFound: Method not found: 'ReportingService.BasicHttpBinding_IReportingService.__str__'

I've set the access_token, refresh_token, client_id, client_secret, and redirect_uri variables.
The error occurs following these steps:

tokens = OAuthTokens(
    access_token=access_token,
    refresh_token=refresh_token)

authn = OAuthWebAuthCodeGrant(
    client_id=client_id,
    client_secret=client_secret,
    redirection_uri=redirect_uri,
    oauth_tokens=tokens)

authz = AuthorizationData(
    authentication=authn,
    developer_token=developer_token)

client = ServiceClient(
    service="ReportingService",
    authorization_data=authz,
    environment="Production",
    version=11)

print client
suds.MethodNotFound: Method not found: 'ReportingService.BasicHttpBinding_IReportingService.__str__'

If I continue with client.SubmitGenerateReport
I'll get this error:

suds.WebFault: Server raised fault: 'Invalid client data. Check the SOAP fault details for more information'

'Connection aborted.' in BulkOperation.download_result_file with ssl.PROTOCOL_SSLv23

We use BulkServiceManager download_entities method to get campaigns and ad_groups, code copied from this example.

After update to a3d33d8 we constantly get ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) error in BulkOperation.download_result_file method r = s.get(...) call.
Example mentioned above doesn't work too.

Change to previous state fixes both our code and example:

+            ssl_version=ssl.PROTOCOL_SSLv3,
-            ssl_version=ssl.PROTOCOL_SSLv23,

Tested:
Ubuntu 14.04,
Python 2.7.6 and Python 3.4.0,
bingads==9.3.4,
requests==2.7.0.

Allow alternatives to default suds file cache

The suds client instantiated at https://github.com/bing-ads-sdk/BingAds-Python-SDK/blob/master/bingads/service_client.py#L250-L252 uses the default suds caching strategy and file location (thats /tmp/suds, where the /tmp part comes from gettempdir()).

That means if two users run this test program:

from bingads import ServiceClient
#EOF

the one that comes second will see this error:

Traceback (most recent call last):
  File "bin/python", line 146, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "a.py", line 1, in <module>
    from bingads import ServiceClient
  File "/x/eggs/bingads-9.3.2-py2.7.egg/bingads/__init__.py", line 3, in <module>
    from .service_client import *
  File "/x/eggs/bingads-9.3.2-py2.7.egg/bingads/service_client.py", line 251, in <module>
    'file:///' + pkg_resources.resource_filename('bingads', 'proxies/campaign_management_service.xml')
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/client.py", line 112, in __init__
    kwargs["cache"] = ObjectCache(days=1)
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/cache.py", line 119, in __init__
    self.checkversion()
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/cache.py", line 242, in checkversion
    self.clear()
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/cache.py", line 211, in clear
    for fn in os.listdir(self.location):
OSError: [Errno 13] Permission denied: '/tmp/suds'

Would be great if that was configurable (eg. if it was possible to provide the cache argument to the suds client).

CustomerBillingService:AddInsertionOrderRequest creates double nested InsertionOrder

When debugging our code I noticed that the SOAP request generated by 11.12.x contains an InsertionOrder inside another InsertionOrder. The effect is that the response from bingads server contains error code 1001, The user is not authorized to perform this action. When you manually submit the same SOAP request but with only one level of InsertionOrder, it works as expected.

The problem appears to be with this SDK. I've developed a workaround that has 2 parts. First I'm using InsertionOrderTagDeduplicatorPlugin, a suds plugin to edit context.envelope on sending. Second is a fix to SDK via #93 to enable the plugin to work.

Here's my calling code, simplified - an error is thrown at the last line without the plugin or without #93.

from bingads.service_client import ServiceClient
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)

class InsertionOrderTagDeduplicatorPlugin(MessagePlugin):
    def sending(self, context):
        context.envelope = context.envelope.replace(b"<ns0:InsertionOrder><ns0:InsertionOrder>",    b"<ns0:InsertionOrder>")
        context.envelope = context.envelope.replace(b"</ns0:InsertionOrder></ns0:InsertionOrder>", b"</ns0:InsertionOrder>")
        context.envelope = context.envelope.replace(b"<ns1:InsertionOrder><ns1:InsertionOrder>",    b"<ns1:InsertionOrder>")
        context.envelope = context.envelope.replace(b"</ns1:InsertionOrder></ns1:InsertionOrder>", b"</ns1:InsertionOrder>")
        context.envelope = context.envelope.replace(b"<ns2:InsertionOrder><ns2:InsertionOrder>",    b"<ns2:InsertionOrder>")
        context.envelope = context.envelope.replace(b"</ns2:InsertionOrder></ns2:InsertionOrder>", b"</ns2:InsertionOrder>")
        context.envelope = context.envelope.replace(b"<ns3:InsertionOrder><ns3:InsertionOrder>",    b"<ns3:InsertionOrder>")
        context.envelope = context.envelope.replace(b"</ns3:InsertionOrder></ns3:InsertionOrder>", b"</ns3:InsertionOrder>")
        return context

....

self.master_customer_billing_service = ServiceClient(
    service='CustomerBillingService',
    authorization_data=self.authorization_data,
    environment=Config.environment,
    version=11,
    plugins=[InsertionOrderTagDeduplicatorPlugin()]
)

request = self.master_customer_billing_service.factory.create("AddInsertionOrderRequest")
request.InsertionOrder.AccountId = self.account_id
request.InsertionOrder.BookingCountryCode = country_code
request.InsertionOrder.Comment = comment or "--No Comment--"
request.InsertionOrder.StartDate = start_date.format("YYYY-MM-DD")
request.InsertionOrder.EndDate = end_date
request.InsertionOrder.PurchaseOrder = po_number
request.InsertionOrder.Name = budget_name.strip()
request.InsertionOrder.SpendCapAmount = budget
request.InsertionOrder.Status = None

nested_partial_errors = self.master_customer_billing_service.AddInsertionOrder(request)

Here's the SOAP request with InsertionOrder inside another InsertionOrder

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:tns="https://bingads.microsoft.com/Billing/v11"
  xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:ns1="https://bingads.microsoft.com/Customer/v11/Entities"
  xmlns:ns2="https://bingads.microsoft.com/Billing/v11">
  <SOAP-ENV:Header>
    <tns:AuthenticationToken>____SNIP____</tns:AuthenticationToken>
    <tns:DeveloperToken>____SNIP____</tns:DeveloperToken>
  </SOAP-ENV:Header>
  <ns0:Body>
    <ns2:AddInsertionOrderRequest>
      <ns2:InsertionOrder>
        <ns2:InsertionOrder>
          <ns1:AccountId>152028363</ns1:AccountId>
          <ns1:BookingCountryCode>US</ns1:BookingCountryCode>
          <ns1:Comment>--No Comment--</ns1:Comment>
          <ns1:EndDate>2018-08-31</ns1:EndDate>
          <ns1:SpendCapAmount>500.0</ns1:SpendCapAmount>
          <ns1:StartDate>2018-08-03</ns1:StartDate>
          <ns1:Name>2018-08-01</ns1:Name>
          <ns1:PurchaseOrder></ns1:PurchaseOrder>
        </ns2:InsertionOrder>
      </ns2:InsertionOrder>
    </ns2:AddInsertionOrderRequest>
  </ns0:Body>
</SOAP-ENV:Envelope>

DEBUG:suds.client:HTTP failed - 500 - Internal Server Error:

<s:Envelope
  xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode>s:Server</faultcode>
      <faultstring xml:lang="en-US">Invalid client data. Check the SOAP fault details for more information</faultstring>
      <detail>
        <ApiFault
          xmlns="https://bingads.microsoft.com/Billing/v11"
          xmlns:a="https://bingads.microsoft.com/Customer/v11/Exception"
          xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <TrackingId
            xmlns="https://adapi.microsoft.com">44897043-606c-472f-ac2e-146bbec382ed
          </TrackingId>
          <a:OperationErrors>
            <a:OperationError>
              <a:Code>1001</a:Code>
              <a:Details/>
              <a:Message>The user is not authorized to perform this action.</a:Message>
            </a:OperationError>
          </a:OperationErrors>
        </ApiFault>
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

Here's a successful SOAP request and response

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:tns="https://bingads.microsoft.com/Billing/v11"
  xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:ns1="https://bingads.microsoft.com/Customer/v11/Entities"
  xmlns:ns2="https://bingads.microsoft.com/Billing/v11">
  <SOAP-ENV:Header>
    <tns:AuthenticationToken>____SNIP____</tns:AuthenticationToken>
    <tns:DeveloperToken>____SNIP____</tns:DeveloperToken>
  </SOAP-ENV:Header>
  <ns0:Body>
    <ns2:AddInsertionOrderRequest>
      <ns2:InsertionOrder>
        <ns1:AccountId>152028363</ns1:AccountId>
        <ns1:BookingCountryCode>US</ns1:BookingCountryCode>
        <ns1:Comment>--No Comment--</ns1:Comment>
        <ns1:EndDate>2018-08-31</ns1:EndDate>
        <ns1:SpendCapAmount>500.0</ns1:SpendCapAmount>
        <ns1:StartDate>2018-08-08</ns1:StartDate>
        <ns1:Name>2018-08-01</ns1:Name>
        <ns1:PurchaseOrder></ns1:PurchaseOrder>
      </ns2:InsertionOrder>
    </ns2:AddInsertionOrderRequest>
  </ns0:Body>
</SOAP-ENV:Envelope>

<s:Envelope
  xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:TrackingId
      xmlns:h="https://bingads.microsoft.com/Billing/v11">2c244a4d-0e80-4f68-a4b7-e1f14ba993a7
    </h:TrackingId>
  </s:Header>
  <s:Body>
    <AddInsertionOrderResponse
      xmlns="https://bingads.microsoft.com/Billing/v11">
      <InsertionOrderId>419433954</InsertionOrderId>
      <CreateTime>2018-08-08T12:22:55</CreateTime>
    </AddInsertionOrderResponse>
  </s:Body>
</s:Envelope>

Import throw error "instance() takes at least 1 argument (0 given)"

Hi,
when I import bingads it throws this error: "instance() takes at least 1 argument (0 given)"

>>> from bingads import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "[MYPATH]\.venv\lib\site-packages\bingads\__init__.py", line 6, in <module>
    import bingads.bulk  # noqa
  File "[MYPATH]\.venv\lib\site-packages\bingads\bulk\__init__.py", line 8, in <module>
    from .file_reader import *
  File "[MYPATH]\.venv\lib\site-packages\bingads\bulk\file_reader.py", line 2, in <module>
    from .entities.bulk_entity import BulkEntity
  File "[MYPATH]\.venv\lib\site-packages\bingads\bulk\entities\__init__.py", line 13, in <module>
    from .ad_extensions import *
  File "[MYPATH]\.venv\lib\site-packages\bingads\bulk\entities\ad_extensions\__init__.py", line 3, in <module>
    from .bulk_call_ad_extensions import *
  File "[MYPATH]\.venv\lib\site-packages\bingads\bulk\entities\ad_extensions\bulk_call_ad_extensions.py", line 9, in <module>
    _CallAdExtension = type(_CAMPAIGN_OBJECT_FACTORY.create('CallAdExtension'))
  File "[MYPATH]\.venv\lib\site-packages\bingads\service_client.py", line 286, in _create_with_cache
    copied_obj = _suds_objects_deepcopy(obj)
  File "[MYPATH]\.venv\lib\site-packages\bingads\service_client.py", line 275, in _suds_objects_deepcopy
    new = origin_type()
TypeError: instance() takes at least 1 argument (0 given)

I'm running on Python 2.7, with bingads 9.3.2

Memory usage

I am having some memory issues when downloading reports. I checked a large portion of the source code and it seems that iterators and streaming is used all over the place. However this line bogs me -

f.write(compressed.read(first))
doesn't it result in reading the whole file in memory?

and shouldn't it be something along these lines?

                with contextlib.closing(zipfile.ZipFile(zip_file_path)) as compressed:
                    first = compressed.namelist()[0]
                    with open(result_file_path, 'wb') as f, compressed.open(first, 'r') as c:
                        for line in c:
                            f.write(c)

ServiceClient creating fails for sandbox environment

Instantiating a ServiceClient for CampaignManagementService fails with sandbox environment, e.g.

from bingads import ServiceClient

if __name__ == '__main__':
    service = ServiceClient('CampaignManagementService',
            authorization_data=None,
            environment='sandbox')

fails with:

Traceback (most recent call last):
  File "bin/python", line 146, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "/tmp/a.py", line 6, in <module>
    environment='sandbox')
  File "/x/etc/eggs/bingads-9.3.2-py2.7.egg/bingads/service_client.py", line 31, in __init__
    self._soap_client = Client(self.service_url)
  File "/x/etc/eggs/suds_jurko-0.6-py2.7.egg/suds/client.py", line 115, in __init__
    self.wsdl = reader.open(url)
  File "/x/etc/eggs/suds_jurko-0.6-py2.7.egg/suds/reader.py", line 150, in open
    d = self.fn(url, self.options)
  File "/x/etc/eggs/suds_jurko-0.6-py2.7.egg/suds/wsdl.py", line 160, in __init__
    self.set_wrapped()
  File "/x/etc/eggs/suds_jurko-0.6-py2.7.egg/suds/wsdl.py", line 266, in set_wrapped
    raise TypeNotFound(query.ref)
suds.TypeNotFound: Type not found: '(SetNegativeSitesToAdGroups2Request, https://bingads.microsoft.com/CampaignManagement/v9, )'

The example works (no exception raised) if you change sandbox to production

Report Requests Error

Hi,

I'm trying to get the report download script from this link working:

https://msdn.microsoft.com/en-us/library/bing-ads-reporting-request-and-download-a-keyword-performance-report-in-python.aspx

I've entered my credentials as requested however I get the following message. I'm on OSX using bingads 10.4.1

Thanks
Jacob

TypeError                                 Traceback (most recent call last)
<ipython-input-1-7ef94934851a> in <module>()
----> 1 from bingads.service_client import ServiceClient
      2 from bingads.authorization import *
      3 from bingads import *
      4 from bingads.reporting import *
      5 

/Users/jb/anaconda/lib/python2.7/site-packages/bingads/__init__.py in <module>()
      4 from .authorization import *
      5 
----> 6 import bingads.bulk  # noqa
      7 
      8 __author__ = 'Bing Ads SDK Team'

/Users/jb/anaconda/lib/python2.7/site-packages/bingads/bulk/__init__.py in <module>()
      6 from .upload_parameters import *
      7 from .bulk_operation import *
----> 8 from .file_reader import *
      9 from .file_writer import *
     10 from .bulk_service_manager import *

/Users/jb/anaconda/lib/python2.7/site-packages/bingads/bulk/file_reader.py in <module>()
      1 from .enums import DownloadFileType, ResultFileType
----> 2 from .entities.bulk_entity import BulkEntity
      3 from ..internal.bulk.stream_reader import _BulkStreamReader
      4 from ..internal.bulk.entities.multi_record_bulk_entity import _MultiRecordBulkEntity
      5 

/Users/jb/anaconda/lib/python2.7/site-packages/bingads/bulk/entities/__init__.py in <module>()
      6 from .unknown_bulk_entity import *
      7 from .bulk_account import *
----> 8 from .bulk_campaign import *
      9 from .bulk_ad_group import *
     10 from .bulk_ad_group_product_target import *

/Users/jb/anaconda/lib/python2.7/site-packages/bingads/bulk/entities/bulk_campaign.py in <module>()
      6 from bingads.internal.extensions import bulk_str, csv_to_budget, budget_to_csv
      7 
----> 8 _ShoppingSetting = type(_CAMPAIGN_OBJECT_FACTORY.create('ShoppingSetting'))
      9 
     10 

/Users/jb/anaconda/lib/python2.7/site-packages/bingads/service_client.pyc in _create_with_cache(self, name)
    294         self.object_cache[name] = self.create_without_cache(name)
    295     obj = self.object_cache[name]
--> 296     copied_obj = _suds_objects_deepcopy(obj)
    297     return copied_obj
    298 

/Users/jb/anaconda/lib/python2.7/site-packages/bingads/service_client.pyc in _suds_objects_deepcopy(origin)
    283         new.__metadata__ = origin.__metadata__
    284         return new
--> 285     new = origin_type()
    286     for name in origin.__keylist__:
    287         setattr(new, name, _suds_objects_deepcopy(getattr(origin, name)))

TypeError: instance() takes at least 1 argument (0 given)

BulkAdGroupLocationCriterion Target mapping breaks in Python 3

Hi,
In the BulkAdGroupLocationCriterion Target mappings, the code tries to cast the value to a Long data type if the value is defined. This is valid in Python 2, however in Python 3 it no longer exists.

NameError: name 'long' is not defined

https://github.com/BingAds/BingAds-Python-SDK/blob/master/bingads/v11/bulk/entities/target_criterions/bulk_ad_group_location_criterion.py#L68

The solution would be to use long if the Python version is 2, and int if it is Python 3.

Thanks!

Download report issue with example code

Hi
Below is my code for download campaign report.

download.py

from authenticator import *
from bingads.v12.reporting import *
FILE_DIRECTORY='/home/mohammaddilshad/feed_dowloader/bing/feeds'
DOWNLOAD_FILE_NAME='download.csv'
REPORT_FILE_FORMAT='csv'

# The maximum amount of time (in milliseconds) that you want to wait for the report download.
TIMEOUT_IN_MILLISECONDS=3600000
ENVIRONMENT='production'


def main(authorization_data):

    try:
        report_request = get_campaign_performance_report_request(None)

        reporting_download_parameters = ReportingDownloadParameters(
            report_request=report_request,
            result_file_directory=FILE_DIRECTORY,
            result_file_name=DOWNLOAD_FILE_NAME,
            overwrite_result_file=True,  # Set this value true if you want to overwrite the same file.
            timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS
   
        )

    
        print("Awaiting Background Completion . . .")
        background_completion(reporting_download_parameters)

    except Exception as ex:
        print ex


def get_campaign_performance_report_request(campaign_ids):
    '''
    Build a campaign performance report request, including Format, ReportName,
    Time, and Columns.
    '''
    report_request=reporting_service.factory.create('CampaignPerformanceReportRequest')
    report_request.Format=REPORT_FILE_FORMAT
    report_request.ReportName='My Campaign Performance Report'
    report_request.ReturnOnlyCompleteData=False
    report_request.Aggregation='Daily'
    report_request.Language='English'

    scope=reporting_service.factory.create('AccountThroughCampaignReportScope')
    if campaign_ids is None:
        scope.AccountIds={'long': [authorization_data.account_id] }
        scope.Campaigns=None
    else:
        scope.AccountIds=None
        campaigns=reporting_service.factory.create('ArrayOfCampaignReportScope')
        for campaign_id in campaign_ids['long']:
            campaign_report_scope=reporting_service.factory.create('CampaignReportScope')
            campaign_report_scope.AccountId=authorization_data.account_id
            campaign_report_scope.CampaignId=campaign_id
            campaigns.CampaignReportScope.append(campaign_report_scope)
        scope.Campaigns=campaigns
    report_request.Scope=scope

    # You may either use a custom date range or predefined time.
    report_time=reporting_service.factory.create('ReportTime')
    report_time.PredefinedTime='2018-06-01'
    report_time.ReportTimeZone='PacificTimeUSCanadaTijuana'
    report_request.Time=report_time

    # Specify the attribute and data report columns.

    report_columns=reporting_service.factory.create('ArrayOfCampaignPerformanceReportColumn')
    report_columns.CampaignPerformanceReportColumn.append([
        'TimePeriod',
        'AccountId',
        'CampaignId',
        'CampaignName',
        'Conversions',
        'DeviceType',
        'BidMatchType',
        'Clicks',
        'Impressions',
        'Ctr',
        'AverageCpc',
        'Spend',
        'AverageCpm',
        'AverageDurationPerVisit',
        'AveragePagesPerVisit',
        'AveragePosition',
        'ConversionRate',
        'ImpressionSharePercent',
        'Ptr',
        'QualityScore',
        'Revenue',
        'TotalVisits',
    ])
    report_request.Columns=report_columns
    print "report request", report_request
    return report_request
def background_completion(reporting_download_parameters):

    global reporting_service_manager
    result_file_path = reporting_service_manager.download_file(reporting_download_parameters)
    print("Download result file: {0}\n".format(result_file_path))

def submit_and_download(report_request):

    global reporting_service_manager
    reporting_download_operation = reporting_service_manager.submit_download(report_request)

   
    reporting_operation_status = reporting_download_operation.track(timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS)
    result_file_path = reporting_download_operation.download_result_file(
        result_file_directory = FILE_DIRECTORY,
        result_file_name = DOWNLOAD_FILE_NAME,
        decompress = True,
        overwrite = True,  # Set this value true if you want to overwrite the same file.
        timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS # You may optionally cancel the download after a specified time interval.
    )

# Main execution
if __name__ == '__main__':

    print("Python loads the web service proxies at runtime, so you will observe " \
          "a performance delay between program launch and main execution...\n")

    authorization_data = AuthorizationData(
        account_id="XXXXXX",
        customer_id="XXXXXXXX",
        developer_token="XXXXXXXX",
        authentication=None, )

    print "authorize_Data", AuthorizationData

    reporting_service = ServiceClient(
        'ReportingService',
        version=12,
        authorization_data=authorization_data,
        environment=ENVIRONMENT,
    )

    reporting_service_manager = ReportingServiceManager(
        authorization_data=authorization_data,
        poll_interval_in_milliseconds=5000,
        environment=ENVIRONMENT,
    )

    authenticate(authorization_data)

    main(authorization_data)

authenticator.py
`from bingads.authorization import *

AccessToken="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

def authenticate(authorization_data):
    import logging
    logging.basicConfig(level=logging.INFO)
    logging.getLogger('suds.client').setLevel(logging.DEBUG)
    logging.getLogger('suds.transport.http').setLevel(logging.DEBUG)
    authentication = OAuthWebAuthCodeGrant(client_id="XXXXXXXXXXXXXX",
                                           client_secret="rnxnRSXBOC206@obhC51_;_",
                                           redirection_uri="https://www.tv.com",
                                           oauth_tokens=OAuthTokens(access_token=AccessToken))

    authorization_data.authentication = authentication
 
    print "authorization_data", authorization_data

    def oauth_tokens(self):
        return self._oauth_tokens


if __name__ == "__main__":
    authorization_data = AuthorizationData(
        account_id="XXXXXXXXXXXXX",
        customer_id="XXXXXXXXXXXXXXXXXXX",
        developer_token="XXXXXXXXXXXXXXXXX",
        authentication=None, )

SOP Error.

authorize_Data bingads.authorization.AuthorizationData
authorization_data <bingads.authorization.AuthorizationData instance at 0x7f2cc12aae60>
report request (CampaignPerformanceReportRequest){
ExcludeColumnHeaders = None
ExcludeReportFooter = None
ExcludeReportHeader = None
Format = "csv"
Language = "English"
ReportName = "My Campaign Performance Report"
ReturnOnlyCompleteData = False
Aggregation = "Daily"
Columns =
(ArrayOfCampaignPerformanceReportColumn){
CampaignPerformanceReportColumn[] =

        "TimePeriod",
        "AccountId",
        "CampaignId",
        "CampaignName",
        "Conversions",
        "DeviceType",
        "BidMatchType",
        "Clicks",
        "Impressions",
        "Ctr",
        "AverageCpc",
        "Spend",
        "AverageCpm",
        "AverageDurationPerVisit",
        "AveragePagesPerVisit",
        "AveragePosition",
        "ConversionRate",
        "ImpressionSharePercent",
        "Ptr",
        "QualityScore",
        "Revenue",
        "TotalVisits",,
  }

Filter =
(CampaignPerformanceReportFilter){
AccountStatus = None
AdDistribution = None
DeviceOS = None
DeviceType = None
Status = None
}
Scope =
(AccountThroughCampaignReportScope){
AccountIds =
{
long[] =
"136004299",
}
Campaigns = None
}
Time =
(ReportTime){
CustomDateRangeEnd =
(Date){
Day = None
Month = None
Year = None
}
CustomDateRangeStart =
(Date){
Day = None
Month = None
Year = None
}
PredefinedTime = "2018-06-01"
ReportTimeZone = "PacificTimeUSCanadaTijuana"
}
}
Awaiting Background Completion . . .
DEBUG:suds.client:sending to (https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V12/ReportingService.svc)
message:

<SOAP-ENV:Envelope xmlns:tns="https://bingads.microsoft.com/Reporting/v12" xmlns:ns0="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="https://bingads.microsoft.com/Reporting/v12" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
SOAP-ENV:Header
tns:AuthenticationTokenXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</tns:AuthenticationToken>
tns:CustomerAccountIdxxxx</tns:CustomerAccountId>
tns:CustomerIdxxx</tns:CustomerId>
tns:DeveloperTokenxxxxxxxx</tns:DeveloperToken>
</SOAP-ENV:Header>
ns1:Body
ns2:SubmitGenerateReportRequest
<ns2:ReportRequest xsi:type="ns2:CampaignPerformanceReportRequest">
ns2:Formatcsv</ns2:Format>
ns2:LanguageEnglish</ns2:Language>
ns2:ReportNameMy Campaign Performance Report</ns2:ReportName>
ns2:ReturnOnlyCompleteDatafalse</ns2:ReturnOnlyCompleteData>
ns2:AggregationDaily</ns2:Aggregation>
ns2:Columns
ns2:CampaignPerformanceReportColumnTimePeriod</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnAccountId</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnCampaignId</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnCampaignName</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnConversions</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnDeviceType</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnBidMatchType</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnClicks</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnImpressions</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnCtr</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnAverageCpc</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnSpend</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnAverageCpm</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnAverageDurationPerVisit</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnAveragePagesPerVisit</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnAveragePosition</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnConversionRate</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnImpressionSharePercent</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnPtr</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnQualityScore</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnRevenue</ns2:CampaignPerformanceReportColumn>
ns2:CampaignPerformanceReportColumnTotalVisits</ns2:CampaignPerformanceReportColumn>
</ns2:Columns>
ns2:Scope
ns2:AccountIds
ns0:longXXXXXXXXXXXXXXX</ns0:long>
</ns2:AccountIds>
</ns2:Scope>
ns2:Time
ns2:PredefinedTime2018-06-01</ns2:PredefinedTime>
ns2:ReportTimeZonePacificTimeUSCanadaTijuana</ns2:ReportTimeZone>
</ns2:Time>
</ns2:ReportRequest>
</ns2:SubmitGenerateReportRequest>
</ns1:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'SOAPAction': '"SubmitGenerateReport"', 'Content-Type': 'text/xml; charset=utf-8', 'User-Agent': 'BingAdsSDKPython 11.12.4 (2, 7, 15)'}
DEBUG:suds.transport.http:sending:
URL: https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V12/ReportingService.svc
HEADERS: {'Soapaction': '"SubmitGenerateReport"', 'SOAPAction': '"SubmitGenerateReport"', 'User-agent': 'BingAdsSDKPython 11.12.4 (2, 7, 15)', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'User-Agent': 'BingAdsSDKPython 11.12.4 (2, 7, 15)'}
MESSAGE:

*****************XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX105S5D231O576863csvEnglishMy Campaign Performance ReportfalseDailyTimePeriodAccountIdCampaignIdCampaignNameConversionsDeviceTypeBidMatchTypeClicksImpressionsCtrAverageCpcSpendAverageCpmAverageDurationPerVisitAveragePagesPerVisitAveragePositionConversionRateImpressionSharePercentPtrQualityScoreRevenueTotalVisits1360042992018-06-01PacificTimeUSCanadaTijuana

DEBUG:suds.client:HTTP failed - 500 - Internal Server Error:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault>s:ServerInvalid client data. Check the SOAP fault details for more information868d5d6a-3470-4d9e-8021-34c740527b9b105InvalidCredentialsAuthentication failed. Either supplied credentials are invalid or the account is inactive</s:Fault></s:Body></s:Envelope>
ERROR:suds.client:<suds.sax.document.Document instance at 0x7f2cc047ba28>
Server raised fault: 'Invalid client data. Check the SOAP fault details for more information'

Error: KeyError: 'error_description'

I got OAuthTokenRequestException, but it was not raised correctly (due to KeyError: 'error_description'), so I don't know what's the issue (not able to reproduce it)

the traceback:

File "/usr/local/lib/python2.7/dist-packages/bingads/authorization.py", line 405, in request_oauth_tokens_by_refresh_token
      refresh_token=refresh_token,
File "/usr/local/lib/python2.7/dist-packages/bingads/authorization.py", line 585, in get_access_token
      raise OAuthTokenRequestException(error_json['error'], error_json['error_description'])

Bing Delete Adgroup Issue

I am getting an error

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/v10:AdGroupIds. The InnerException message was 'There was an error deserializing the object of type System.Int64[]. End element 'AdGroupIds' from namespace 'https://bingads.microsoft.com/CampaignManagement/v10' expected. Found text '1144591690019879'. Line 1, position 1743.'. Please see InnerException

While deleting an ad groups.

I am passing an array of Long, also tried passing the single value as well, but the same error is displayed.

Code Sample

delete_adgroup_response = campaign_service.DeleteAdGroups(
CampaignId= xxxxxxxx,
AdGroupIds= xxxxxxxxxxxxxL,
)

AdGroupPerformanceReportColumn returns "Type not found: 'AccountName'"

I can get the 'report_request.py' script to work just fine.
But when I try to run an Ad Group Performance Report, suds returns the error Type not found: 'AccountName'

def get_adgroup_performance_report_request():

    report_request=reporting_service.factory.create('AdGroupPerformanceReportColumn')
    report_request.Format=REPORT_FILE_FORMAT
    report_request.ReportName='My Ad Group Performance Report'
    report_request.ReturnOnlyCompleteData=False
    report_request.Aggregation='Daily'
    report_request.Language='English'

    scope=reporting_service.factory.create('AccountThroughAdGroupReportScope')
    scope.AccountIds={'long': [authorization_data.account_id] }
    scope.Campaigns=None
    scope.AdGroups=None

    report_request.Scope=scope
    report_time=reporting_service.factory.create('ReportTime')

    report_time.PredefinedTime='LastFourWeeks'
    report_request.Time=report_time

    report_columns=reporting_service.factory.create('ArrayOfAdGroupPerformanceReportColumn')
    report_columns.AdGroupPerformanceReportColumn.append([
        'AccountName'
        'TimePeriod',
        'AccountId',
        'AdGroupId',
        'AdGroupName',
        'CampaignId',
        'CampaignName',
        'Clicks',
        'Impressions',
        'Ctr',
        'AverageCpc',
        'Spend',
        'QualityScore'
    ])
    report_request.Columns=report_columns

    return report_request

Then I pass the report_request to ReportingDownloadParameters, like it is done in the example.

    report_request = get_adgroup_performance_report_request()

    reporting_download_parameters = ReportingDownloadParameters(
        report_request=report_request,
        result_file_directory = FILE_DIRECTORY, 
        result_file_name = DOWNLOAD_FILE_NAME, 
        overwrite_result_file = True, # Set this value true if you want to overwrite the same file.
        timeout_in_milliseconds=3600000 # You may optionally cancel the download after a specified time interval.
    )

    result_file_path = reporting_service_manager.download_file(reporting_download_parameters)
    print("Download result file: {0}\n".format(result_file_path))

I've been able to get the CampaignPerformanceReport to work just fine, and the examples work too, but for some reason this AdGroupPerformanceReport does not. Is it an issue with the BingAds SDK, or suds?

pro-grammatically could n't retrieve keyword suggestions from keyword planner tool

Hi ,

I am new to Bing ads API . i couldn't retrieve the keyword suggestions from bing keyword planner tool. here is the sample program i am following https://docs.microsoft.com/en-us/bingads/guides/code-example-keywords-ads?view=bingads-11.

i generated the refresh token and followed the above link.I made changes in the program to make use of 'querySearchParameter' but the result set is showing each keywordIdea with following values . AdGroupId,AdGroupName,AdImpressionShare,Competition,Keyword,MonthlySearchCounts,Relevance,Source,SuggestedBid.

i am looking to get the keyword suggestions from keyword planner. Please Suggest

thank you ,
Bhavana

reporting_service_manager not working

Ultimately, I want to download a report using:

reporting_download_operation = reporting_service_manager.submit_download(report_request)

This is the error message I get when executing:

    reporting_service_manager=ReportingServiceManager(
       authorization_data=authorization_data, 
       poll_interval_in_milliseconds=5000, 
      environment=ENVIRONMENT,
   )

ValueError: Cannot find version: [v10] service: [ReportingService] under environment: [production]. Please notice that campaign management, bulk, ad intelligence and optimizer services were deprecated in v9

TypeError: instance() takes at least 1 argument (0 given)

Hello, I see the following error when importing the ServiceClient module (it used to work fine until today):

File "BingGeoLocationPerformance.py", line 1, in <module>
    from bingads.service_client import ServiceClient
  File "C:\Python27\lib\site-packages\bingads\__init__.py", line 6, in <module>
    import bingads.bulk  # noqa
  File "C:\Python27\lib\site-packages\bingads\bulk\__init__.py", line 11, in <module>
    from .file_reader import *
  File "C:\Python27\lib\site-packages\bingads\bulk\file_reader.py", line 2, in <module>
    from .entities.bulk_entity import BulkEntity
  File "C:\Python27\lib\site-packages\bingads\bulk\entities\__init__.py", line 11, in <module>
    from .bulk_campaign import *
  File "C:\Python27\lib\site-packages\bingads\bulk\entities\bulk_campaign.py", line 8, in <module>
    _ShoppingSetting = type(_CAMPAIGN_OBJECT_FACTORY.create('ShoppingSetting'))
  File "C:\Python27\lib\site-packages\bingads\service_client.py", line 343, in _create_with_cache
    copied_obj = _suds_objects_deepcopy(obj)
  File "C:\Python27\lib\site-packages\bingads\service_client.py", line 332, in _suds_objects_deepcopy
    new = origin_type()
TypeError: instance() takes at least 1 argument (0 given)

Any idea? Thanks!

Readme is unreadable

This seems to be an email message and not a normal Readme.md. Please provide a valid Readme.md with valid content.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.