华为应用市场api没有return一个应用的评论列表
Huawei appgallery api does not return comment list of an app
我尝试从 app_id 获取评论列表。我按照文档中的所有操作,但我不明白为什么我无法获得评论列表。
import requests
import json
import datetime,time
from datetime import timedelta,datetime
client_id = "5****";
client_secret = "95C92DF16****";
grant_type = "client_credentials";
r = requests.post('https://connect-api-drru.cloud.huawei.com/api/oauth2/v1/token',
json={"grant_type": grant_type, "client_id":client_id, "client_secret":client_secret})
js = json.loads(r.text)
token = js["access_token"]
begin_time = (datetime.strptime('2010-02-01 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
end_time = (datetime.strptime('2021-02-19 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
app_id = "103154181"
url = "https://connect-api-drru.cloud.huawei.com/api/reviews/v1/manage/dev/reviews/"
countries = 'RU'
headers = {'Authorization': 'Bearer ' + token, 'client_id':client_id}
r = requests.get(url + "?appId=" + app_id + "&beginTime=" +str(int(begin_time)) + "&endTime=" +str(int(end_time)) + "&countries=" + countries+ "&page=1", headers=headers)
print(r.text)
请求输出
{"ret":{"rtnCode":0,"rtnDesc":"success"},"data":{"reviewList":[],"hasNext":0,"total":0}}
Screen from admin menu
我认为下面代码的时间是错误的。
begin_time = (datetime.strptime('2010-02-01 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
end_time = (datetime.strptime('2021-02-19 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
你统计的是从1970年1月1日到现在的秒,根据Docs,这个值就是总次数毫秒 自 1970-01-01 08:00:00.
我尝试从 app_id 获取评论列表。我按照文档中的所有操作,但我不明白为什么我无法获得评论列表。
import requests
import json
import datetime,time
from datetime import timedelta,datetime
client_id = "5****";
client_secret = "95C92DF16****";
grant_type = "client_credentials";
r = requests.post('https://connect-api-drru.cloud.huawei.com/api/oauth2/v1/token',
json={"grant_type": grant_type, "client_id":client_id, "client_secret":client_secret})
js = json.loads(r.text)
token = js["access_token"]
begin_time = (datetime.strptime('2010-02-01 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
end_time = (datetime.strptime('2021-02-19 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
app_id = "103154181"
url = "https://connect-api-drru.cloud.huawei.com/api/reviews/v1/manage/dev/reviews/"
countries = 'RU'
headers = {'Authorization': 'Bearer ' + token, 'client_id':client_id}
r = requests.get(url + "?appId=" + app_id + "&beginTime=" +str(int(begin_time)) + "&endTime=" +str(int(end_time)) + "&countries=" + countries+ "&page=1", headers=headers)
print(r.text)
请求输出
{"ret":{"rtnCode":0,"rtnDesc":"success"},"data":{"reviewList":[],"hasNext":0,"total":0}}
Screen from admin menu
我认为下面代码的时间是错误的。
begin_time = (datetime.strptime('2010-02-01 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
end_time = (datetime.strptime('2021-02-19 00:00:00', '%Y-%m-%d %H:%M:%S')- datetime(1970,1,1)).total_seconds()
你统计的是从1970年1月1日到现在的秒,根据Docs,这个值就是总次数毫秒 自 1970-01-01 08:00:00.