How can I convert this cURL command to a python script? -


curl -x post -h "content-type: application/x-www-form-urlencoded" -d 'client_id=535fb089-9ff3-47b6-9bfb-4f1264799865&scope=https%3a%2f%2fgraph.microsoft.com%2f.default&client_secret=qwgdyamab0yskul1qkv5bpx&grant_type=client_credentials' 'https://login.microsoftonline.com/common/oauth2/v2.0/token' 

here command.

how sample script?

sample script :

import json import requests  url = "https://login.microsoftonline.com/common/oauth2/v2.0/token" payload = {     "client_id": "535fb089-9ff3-47b6-9bfb-4f1264799865",     "client_secret": "qwgdyamab0yskul1qkv5bpx",     "grant_type": "client_credentials",     "scope": "https://graph.microsoft.com/.default" } headers = {     "content-type": "application/x-www-form-urlencoded" } res = requests.post(url, headers=headers, data=json.dumps(payload)) print(res.text) 

if misunderstand question, i'm sorry.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -