init
Some checks failed
Build And Test / build-and-push (push) Failing after 53s

This commit is contained in:
2024-12-13 17:12:03 +09:00
parent a27be94b19
commit ea11832a53
695 changed files with 71766 additions and 1 deletions

View File

@ -0,0 +1,42 @@
import requests
import json
# def createToken(url, parms):
def createToken(parms):
url = "https://api-identity-infrastructure.nhncloudservice.com/v2.0/tokens"
response = requests.post(url, json=parms) # 응답요청
datas = json.loads(response.text)
# print(datas)
if "error" in datas:
errDict = {
'state' : 'err',
'code' : datas['error']['code'],
'errTitle' : datas['error']['title'],
'errMsg' : datas['error']['message']
}
return errDict
else:
getDict = {
'state' : 'steady',
'tokenValue' : datas['access']['token']['id']
}
# WhatToken = getDict['tokenValue']
return getDict
if __name__ == "__main__":
# 예제 내용
url = "https://api-identity-infrastructure.nhncloudservice.com/v2.0/tokens"
parms = {
"auth": {
"tenantId": "04a2c5b7de7e4d66b970ad950081a7c3", # kr2
"passwordCredentials": {
# "username": "sdjo@injeinc.co.kr",
# "password": "ijinc123!"
}
}
}
print(createToken(url, parms))