Python Microsoft Store API

0
9KB

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

Rechercher
Catégories
Lire la suite
Programming
Python Regex
A RegEx, or Regular Expression, is a sequence of characters that forms a search...
Par Jesse Thomas 2023-04-05 19:02:13 0 8KB
Shopping
Best Computers of 2022
The computer has long been an integral part of the life of modern man. These devices vary in...
Par FWhoop Xelqua 2022-10-30 17:39:51 0 28KB
Business
Mergers and Acquisitions in the Casino Industry: How They Affect Stocks
Mergers and acquisitions (M&A) in the casino industry play an important role in shaping the...
Par Dacey Rankins 2024-09-12 17:29:08 0 11KB
Life Issues
Dead Poets Society. (1989)
Maverick teacher John Keating uses poetry to embolden his boarding school students to new heights...
Par Leonard Pokrovski 2023-04-10 20:31:34 0 23KB
Desktop Publishing
Desktop Publishing: Empowering Creativity and Communication
Desktop publishing (DTP) has transformed the way we create and share printed and digital...
Par Dacey Rankins 2024-10-16 16:52:21 0 18KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov