Python Microsoft Store API

0
12K

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

Căutare
Categorii
Citeste mai mult
Business
Why doesn't Mark Zuckerberg control Facebook and Instagram ads?
A bipartisan group of 19 US lawmakers sent a letter to the CEO of Meta  Mark Zuckerberg, in...
By Dacey Rankins 2024-09-17 20:42:52 0 13K
Business
How Can Solopreneurs Stay Motivated and Productive?
Being a solopreneur comes with a unique set of challenges and rewards. While the freedom to work...
By Dacey Rankins 2025-02-13 16:16:54 0 9K
Business
What Is the Role of Simulation and Risk Analysis?
Simulation and risk analysis are core tools in Management Science, especially in uncertain and...
By Dacey Rankins 2025-08-15 20:29:44 0 2K
Programming
Python Random
If you ever want to make some random choice or number for something, there's a pre-installed...
By Jesse Thomas 2023-02-13 21:54:59 0 10K
Business
What Were Key Turning Points or Defining Moments in a Leader’s Life?
Defining moments can shape a leader’s direction and style. These turning points often arise...
By Dacey Rankins 2025-08-13 21:14:27 0 2K

BigMoney.VIP Powered by Hosting Pokrov