GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing learn.microsoft.com — Get Started Using Python (REST) with Bing Ads API - Microsoft Advertising API Note Access to this page requires authorization. You can try signing in or changing directories. Access to this page requires authorization. You can try changing directories. Get Started Using Python with Bing Ads APITo get started developing Bing Ads API applications with Python, you can start with the provided examples or follow one of the application walkthroughs for a Web or Desktop application. You will need user credentials with access to Microsoft Advertising either in production or sandbox. For the production environment you will need a production developer token. All sandbox clients can use the universal sandbox developer token i.e., BBD37VB98. For more information, please see Get Started With the Bing Ads API and Sandbox. To authenticate via OAuth, you must also register an application and get the corresponding client identifier. You also need to take note of the client secret and redirect URI if you are developing a web application. For more details about registering an application in production and the authorization code grant flow, see Authentication with OAuth and Authentication With the SDKs. Although in production you must use your own application ID (a.k.a. client ID), all Microsoft Advertising customers can use the public "Tutorial Sample App" client ID in sandbox i.e., 00001111-aaaa-2222-bbbb-3333cccc4444. For more information, please see Sandbox. DependenciesThe Bing Ads Python SDK supports Python 3.8 or higher. You should install and run one of the supported versions. The REST-based SDK depends on the following packages, which are installed automatically:
Install the SDKTo install the Bing Ads Python SDK for the first time, run the following either from your IDE or command line prompt.
To confirm that the Bing Ads Python SDK is installed, run the following. You should see msads (<version>) in the output list.
If you already have the Bing Ads Python SDK installed, you can run this command to get the latest bits.
WalkthroughsOnce you have the Bing Ads Python SDK installed, you can either download the examples from GitHub or follow one of the application walkthroughs for a Walkthrough: Bing Ads API Web Application in Python or Walkthrough: Bing Ads API Desktop Application in Python application. Using the REST SDKThe Bing Ads Python SDK communicates with the Microsoft Advertising REST API using OpenAPI-generated client classes backed by Pydantic models. You interact with the API through a ServiceClient instance, which handles authentication headers, endpoint routing, and method dispatch automatically. Setting up a ServiceClientCreate a ServiceClient by passing the service name, API version, authorization data, and target environment.
The following service names are supported: Creating objectsImport model classes directly from
For derived types such as ExpandedTextAd, instantiate the concrete subclass directly — no factory calls or special encoding are required. Custom parameters and other nested objects can be set inline via the constructor.
Calling service operationsBuild a request object and pass it to the corresponding method on the ServiceClient. Methods use snake_case naming.
AuthenticationThe REST SDK uses the standard Error handlingService errors are raised as
For information on parsing batch errors returned in the response body, see Handling Service Errors and Exceptions. See AlsoBing Ads API Client Libraries FeedbackWas this page helpful? NoAdditional resources
|
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |