Python Microsoft Store API

0
9K

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()

Search
Categories
Read More
Shopping
Best Computers of 2022
The computer has long been an integral part of the life of modern man. These devices vary in...
By FWhoop Xelqua 2022-10-30 17:39:51 0 28K
Real Estate
How to choose an apartment? Basic tips when buying a home
The question of how to choose an apartment can seem too complicated – especially if you...
By FWhoop Xelqua 2022-09-26 10:37:51 0 25K
Social Issues
Scarface. (1983)
In 1980 Miami, a determined Cuban immigrant takes over a drug cartel and succumbs to greed. My...
By Leonard Pokrovski 2023-01-23 20:48:35 0 17K
Life Issues
Penguin Bloom 2021
Based on the best-selling book of the same name, the film tells the story of Sam Bloom (Academy...
By Leonard Pokrovski 2022-09-17 19:22:26 0 24K
By Region
Press in the USA
HistoryXIX centuryA new phenomenon of public life was called the pricing policy of American...
By FWhoop Xelqua 2023-01-11 13:50:25 0 16K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov