Created
February 10, 2020 16:35
-
-
Save dajor/d45ddd2bbe98a09f0c835ccca28cb6e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import base64 | |
from oauthlib.oauth2 import BackendApplicationClient | |
from requests_oauthlib import OAuth2Session | |
from requests.auth import HTTPBasicAuth | |
with open('Postman.ionapi') as json_file: | |
data = json.load(json_file) | |
base_url = 'https://mingle-sso.eu1.inforcloudsuite.com:443/FELLOWCONSULTING_DEV' | |
url = base_url + "/as/token.oauth2" | |
data = { | |
'grant_type' : 'password', | |
'username' : data['saak'], | |
'password' : data['sask'], | |
'client_id' : data['ci'], | |
'client_secret' : data['cs'], | |
'scope' : '', | |
'redirect_uri' : 'https://localhost/' | |
} | |
r = requests.post(url, data=data) | |
respone = r.json() | |
url = 'https://mingle-ionapi.eu1.inforcloudsuite.com/ionapi/metadata/v1/FELLOWCONSULTING_DEV/version' | |
headers = {'Authorization': 'Bearer ' +respone["access_token"]} | |
r = requests.post(url, headers=headers) | |
response2 = r.json() | |
print (response2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment