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
Horror
The Twilight Saga: Breaking Dawn - Part 2. (2012)
After the birth of Renesmee/Nessie, the Cullens gather other vampire clans in order to protect...
By Leonard Pokrovski 2023-05-19 20:10:22 0 29K
Animation
The Art of Animation: A Journey Through Motion and Imagination
Animation has evolved from simple sketches to complex digital masterpieces, captivating audiences...
By Dacey Rankins 2024-10-17 17:39:28 0 20K
Running
The Art and Science of Sports Running: A Journey of Endurance and Achievement
Running, the fundamental act of propelling oneself swiftly on foot, transcends mere physical...
By Dacey Rankins 2024-07-08 15:24:40 0 18K
Internet Broadcasts
The Rise of Internet Broadcast News: Redefining Media Consumption
The Rise of Internet Broadcast News: Redefining Media Consumption In an era characterized by...
By Leonard Pokrovski 2024-05-03 19:30:15 0 12K
Business
How Do I Attract and Retain Donors?
Attracting and retaining donors is one of the most important aspects of running a successful...
By Dacey Rankins 2025-03-26 16:34:08 0 5K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov