def __init__(self): # init client stub baiduApiSoap = BaiduNmsApiClient('ReportService') client = baiduApiSoap.client self.client = client self.requestParams = {} self.request = None self.reportTypeDesc = None self.__init_requestParams()
import suds #import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse import sys default_encoding = 'utf-8' if sys.getdefaultencoding() != default_encoding: reload(sys) sys.setdefaultencoding(default_encoding) if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('AccountService') client = baiduApiSoap.client #==== get account info ==== client.service.getAccountInfo() # receive response and print result res = client.last_received() printSoapResponse(res) except Exception, e: print e #tb.print_exc()
import suds import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('FCService') client = baiduApiSoap.client #==== get all fc campaign id==== client.service.getFCCampaignId() # receive response and print result res = client.last_received() printSoapResponse(res) except Exception, e: print e tb.print_exc()
import suds import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse import re if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('GroupConfigService') client = baiduApiSoap.client # """ # set target to kt # """ # # contruct request body # request = client.factory.create('setTargetInfoRequest') # targetInfo = client.factory.create('setTargetInfoRequest.targetInfo') # targetInfo.type = 2 # targetInfo.groupId = 228 # ktItem = client.factory.create('setTargetInfoRequest.targetInfo.ktItem') # ktItem.aliveDays = 30 # ktItem.targetType = 7 # ktWordList1 = client.factory.create('setTargetInfoRequest.targetInfo.ktItem.ktWordList') # ktWordList1.keyword = 'baidu-search' # ktWordList1.pattern = 0 # ktWordList1.qualification = 1 # ktWordList2 = client.factory.create('setTargetInfoRequest.targetInfo.ktItem.ktWordList') # ktWordList2.keyword = 'baidu-union' # ktWordList2.pattern = 1 # ktWordList2.qualification = 3
import suds import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('InterestService') client = baiduApiSoap.client #==== get all system specified interests ==== client.service.getInterest() # receive response and print result res = client.last_received() printSoapResponse(res) #==== get custom interests ==== # send request client.service.getAllCustomInterest() # receive response and print result res = client.last_received() printSoapResponse(res) #==== get custom interests ==== # send request cids = [100109,100110] client.service.getCustomInterest(cids)
import suds import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse import sys default_encoding = 'utf-8' if sys.getdefaultencoding() != default_encoding: reload(sys) sys.setdefaultencoding(default_encoding) if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('PeopleService') client = baiduApiSoap.client #==== get all people ==== client.service.getAllPeople() # receive response and print result res = client.last_received() printSoapResponse(res) #==== set specified people ==== # send request pids = [14, 15, 16] client.service.getPeople(pids) # receive response and print result res = client.last_received() printSoapResponse(res)
import suds import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('GroupService') client = baiduApiSoap.client #==== add group ==== # contruct request body request = client.factory.create('addGroupRequest') group = client.factory.create('addGroupRequest.groupTypes') group.campaignId = 757456 group.groupName = 'test123456' group.price = 200 group.type = 0 group.status = 0 request.groupTypes = [] request.groupTypes.append(group) # send request client.service.addGroup(request.groupTypes) # receive response and print result res = client.last_received() printSoapResponse(res)
from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse from urllib import urlopen from ReportParser import ReportParser from MongoUtil import save_report import sys default_encoding = 'utf-8' if sys.getdefaultencoding() != default_encoding: reload(sys) sys.setdefaultencoding(default_encoding) if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('ReportService') client = baiduApiSoap.client #==== get report id ==== # contruct request body request = client.factory.create('getReportIdRequest') reportType = client.factory.create( 'getReportIdRequest.reportRequestType') reportType.performanceData = [ 'srch', 'click', 'cost', 'ctr', 'cpm', 'acp' ] reportType.startDate = datetime.datetime(int(2014), int(8), int(7)) reportType.endDate = datetime.datetime(int(2014), int(8), int(20)) reportType.idOnly = False reportType.format = 1 #csv reportType.reportType = 2
import suds import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('CampaignService') client = baiduApiSoap.client #==== add campaign==== # contruct request body request = client.factory.create('addCampaignRequest') campaign = client.factory.create('addCampaignRequest.campaignTypes') campaign.campaignName = 'test123456' campaign.budget = 200 campaign.status = 0 request.campaignTypes = [] request.campaignTypes.append(campaign) # send request client.service.addCampaign(request.campaignTypes) # receive response and print result res = client.last_received() printSoapResponse(res) #==== get all campaign id==== # send request client.service.getCampaignId()
import suds import traceback as tb from BaiduNmsApiClientHelper import BaiduNmsApiClient from BaiduNmsApiClientHelper import printSoapResponse if __name__ == "__main__": try: # init client stub baiduApiSoap = BaiduNmsApiClient('CodeService') client = baiduApiSoap.client #==== getAllCategory ==== client.service.getAllCategory() # receive response and print result res = client.last_received() printSoapResponse(res) #==== getAllRegion ==== client.service.getAllRegion() # receive response and print result res = client.last_received() printSoapResponse(res) except Exception, e: print e tb.print_exc()