首页 » Python » python调用百度api的账户消费,展现,点击等信息

python调用百度api的账户消费,展现,点击等信息

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import requests,sys,json,time,datetime

today=datetime.date.today()
oneday=datetime.timedelta(days=1)
yesterday=today-oneday

url = "https://api.baidu.com/json/sms/service/ReportService/getRealTimeData"
data = {"header":{
"username":"",
"password":"",
"token":""
},
"body":{
"realTimeRequestType":{
"reportType":2,
"startDate":str(yesterday),
"endDate":str(yesterday),
"performanceData":["impression","click","cpc","ctr","cost"]

}
}
}
response = requests.post(url,json.dumps(data))
print(response.text)

data = {"header":{
"username":"",
"password":"",
"token":""
},
"body":{
"realTimeRequestType":{
"reportType":2,
"startDate":str(time.strftime("%Y-%m-%d", time.localtime())),
"endDate":str(time.strftime("%Y-%m-%d", time.localtime())),
"performanceData":["impression","click","cpc","ctr","cost"]

}
}
}
response = requests.post(url,json.dumps(data))
print(response.text)

原文链接:python调用百度api的账户消费,展现,点击等信息,转载请注明来源!

0