Python Microsoft Store API

0
9Кб

The following example demonstrates how to obtain an Azure AD access token that you can use to call methods in the Microsoft Store submission API. After you obtain a token, you have 60 minutes to use this token in calls to the Microsoft Store submission API before the token expires. After the token expires, you can generate a new token..

import http.client, json tenantId = "" # Your tenant ID clientId = "" # Your client ID clientSecret = "" # Your client secret tokenEndpoint = "https://login.microsoftonline.com/{0}/oauth2/token" tokenResource = "https://manage.devcenter.microsoft.com" tokenRequestBody = "grant_type=client_credentials&client_id={0}&client_secret={1}&resource={2}".format(clientId, clientSecret, tokenResource) headers = {"Content-Type": "application/x-www-form-urlencoded; charset=utf-8"} tokenConnection = http.client.HTTPSConnection("login.microsoftonline.com") tokenConnection.request("POST", "/{0}/oauth2/token".format(tenantId), tokenRequestBody, headers=headers) tokenResponse = tokenConnection.getresponse() print(tokenResponse.status) tokenJson = json.loads(tokenResponse.read().decode()) print(tokenJson["access_token"]) tokenConnection.close()

Поиск
Категории
Больше
Другое
Отель «Гранд Будапешт». The Grand Budapest Hotel. (2014)
Фильм рассказывает об увлекательных приключениях легендарного консьержа Густава и его юного...
От Nikolai Pokryshkin 2023-03-24 11:02:30 0 22Кб
Business
How Should Equity Be Divided Among Founders?
Equity distribution is one of the most sensitive and impactful decisions a founding team will...
От Dacey Rankins 2025-05-05 14:53:14 0 4Кб
Жизненные вопросы
Земля сынов. The Land of the Sons. (2021)
Конец цивилизации настал. Вода и земля отравлены, выжить практически невозможно. Вдоль реки...
От Nikolai Pokryshkin 2022-09-16 18:52:43 0 28Кб
Financial Services
How perfectly competitive firms make output decisions
Key points As a perfectly competitive firm produces a greater quantity of output,...
От Mark Lorenzo 2023-02-21 15:16:17 0 11Кб
Petanque
Discovering the Charm of Petanque: A Closer Look at the French Game of Precision
In the realm of leisurely yet competitive sports, few embody the spirit of relaxation and...
От Dacey Rankins 2024-07-04 16:05:35 0 15Кб
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov