С
Size: a a a
С
СМ
ER
СМ
СМ
SA
ER
С
R
A
R
import requests
import json
import datetime,time
from datetime import timedelta,datetime
client_id = "***";
client_secret = "***";
grant_type = "client_credentials";
r = requests.post('https://connect-api.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"]
def totimestamp(dt, epoch=datetime(1970,1,1)):
td = dt - epoch
return str((td.microseconds + (td.seconds + td.days * 86400) * 10**6) / 10**6 )
begin_time = datetime.now() - timedelta(hours=1000)
begin_time = totimestamp(begin_time).split('.')[0]
end_time = totimestamp(datetime.now()).split('.')[0]
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=" +begin_time + "&endTime=" +end_time + "&countries=" + countries, headers=headers)
print(r.text)
R
R
R
A
A
R