Skip to content

Latest commit

 

History

History
82 lines (53 loc) · 2.69 KB

README.md

File metadata and controls

82 lines (53 loc) · 2.69 KB

baiduads-sdk

该模块为百度商业API SDK的Python实现。 包含两个模块:

  • baiduads-sdk:手动开发的sdk部分
  • baiduads-sdk-auto: 自动生成的sdk部分

快速开始

环境要求

Python >= 3.6

源码构建

python setup.py install 

PIPY使用

pip install baiduads-sdk

使用方式

以api: /json/sms/service/AccountService/getAccountInfo 为例:

AccountSerivce接口文档

class TestAccountService(unittest.TestCase):
    """AccountService unit test stubs"""

    def setUp(self):
        self.api = AccountService()  # noqa: E501

    def tearDown(self):
        pass

    def test_get_account_info(self):
        # init header
        api_header = ApiRequestHeader(username="********",
                                      password="********",
                                      token="****************",
                                      _spec_property_naming=True)
        # init request
        get_account_req = ApiAccountQueryRequest(accountFields=["pictureOptimizeSegmentStatus"],
                                                 _spec_property_naming=True)

        # init request wrapper
        req_wrapper = GetAccountInfoRequestWrapper(header=api_header,
                                                   body=get_account_req,
                                                   _spec_property_naming=True)
        resp_wrapper = self.api.get_account_info(req_wrapper)
        assert resp_wrapper.header.status == 0

认证

申请权限

权限认证

API 示例

Class Method HTTP request Description
CampaignFeedService addCampaignFeed POST /json/feed/v1/CampaignFeedService/addCampaignFeed
CampaignFeedService deleteCampaignFeed POST /json/feed/v1/CampaignFeedService/deleteCampaignFeed
CampaignFeedService getCampaignFeed POST /json/feed/v1/CampaignFeedService/getCampaignFeed
CampaignFeedService updateCampaignFeed POST /json/feed/v1/CampaignFeedService/updateCampaignFeed

讨论

百度如流讨论群:5995216