Python Microsoft Store API

0
10Кб

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

Поиск
Категории
Больше
Business
How Do I Create a Business Plan for a Startup?
Entrepreneurs seek tips and examples tailored to startups when creating a business plan. A...
От Dacey Rankins 2024-12-18 16:56:58 0 14Кб
Rope Skipping
Rope Skipping: Fitness, Fun, and Endless Possibilities
Rope Skipping: Fitness, Fun, and Endless Possibilities Rope skipping, often referred to as jump...
От Leonard Pokrovski 2024-07-08 02:04:52 0 20Кб
Видео
The Best Branded Videos of All Time, Helpful Tips for Inspiration
Creating effective branded videos is a long-term process that requires constant creativity and...
От FWhoop Xelqua 2023-06-10 20:07:43 0 26Кб
Agriculture and Forestry
Business in Agriculture and Forestry: A Growing Sector
Introduction Agriculture and forestry are vital components of the global economy, providing...
От Dacey Rankins 2024-10-17 17:09:58 0 21Кб
Finance
10 countries with the largest gold reserves.
At the end of 2023, central banks around the world purchased 1037 tons of gold, the second...
От Dacey Rankins 2024-10-22 16:50:43 0 13Кб

BigMoney.VIP Powered by Hosting Pokrov