AutodeskForgeAPIforCloudCreditConsumptionSummary
创始人
2024-11-12 10:00:09
0

Autodesk Forge API 云消费 Credit 汇总。

以下是一个使用 Forge API 拉取云消费 Credit 汇总信息的示例 Python 代码:

import requests
from requests.auth import HTTPBasicAuth
import json
import os

client_id = os.environ['FORGE_CLIENT_ID']
client_secret = os.environ['FORGE_CLIENT_SECRET']
url = 'https://developer.api.autodesk.com/authentication/v1/authenticate'
data = {'client_id': client_id, 'client_secret': client_secret, 'grant_type': 'client_credentials', 'scope': 'data:read'}
response = requests.post(url=url, data=data)
token = response.json()['access_token']
headers = {'Authorization': 'Bearer ' + token}

# Fetch list of Hubs
url = 'https://developer.api.autodesk.com/project/v1/hubs'
response = requests.get(url=url, headers=headers)
hubs = response.json()

# Pick the first hub
hub_id = hubs['data'][0]['id']

# Fetch list of projects in the hub
url = 'https://developer.api.autodesk.com/project/v1/hubs/' + hub_id + '/projects'
response = requests.get(url=url, headers=headers)
projects = response.json()

# Pick the first project
project_id = projects['data'][0]['id']

# Get the consumption data for the project
url = 'https://developer.api.autodesk.com/consumption/v1/organizations/-/projects/' + project_id + '/usage'
response = requests.get(url=url, headers=headers)
consumption_data = response.json()
print(json.dumps(consumption_data, indent=4))

这段代码可以拉取账户中所有项目的消费概要。根据需要修改项目 ID 可以获取具体的项目消费概要。

相关内容

热门资讯

德普辅助器怎么用!wepoke... 德普辅助器怎么用!wepokerplus到底是挂了吗(透视)脚本-一直专业有挂1、上手简单,内置详细...
wepoker软件安装包!德州... wepoker软件安装包!德州局HHpoker透视脚本(透视)脚本-其实必备是有挂wepoker软件...
wepoker透视有吗!WeP... wepoker透视有吗!WePOker有没有透视方法(透视)插件-真是专业真的是有挂运WePOker...
悦扑克脚本!哈糖大菠萝有挂吗5... 悦扑克脚本!哈糖大菠萝有挂吗5个常用方法(透视)神器-原来揭幕真的是有挂进入游戏-大厅左侧-新手福利...
We poker辅助器下载!w... We poker辅助器下载!wepoker私人辅助器(透视)软件-其实曝光是有挂1、下载好We po...
pokemmo手机版透视脚本!... pokemmo手机版透视脚本!wepoker轻量版透视方法(透视)挂-一直关于是有挂1、完成poke...
hhpoker德州有挂吗!we... hhpoker德州有挂吗!wejoker私人辅助软件(透视)技巧-好像总结真的有挂1)wejoker...
红龙poker辅助平台!菠萝德... 红龙poker辅助平台!菠萝德州透视脚本(透视)教程-果然解迷存在有挂1)菠萝德州透视脚本有没有挂:...
拱趴大菠萝十三水透视!德普软件... 拱趴大菠萝十三水透视!德普软件(透视)教程-其实开挂存在有挂1、拱趴大菠萝十三水透视脚本辅助下载、拱...
德州透视是真的吗!hhpoke... 德州透视是真的吗!hhpoker破解工具(透视)app-一直开挂是有挂1、德州透视是真的吗辅助器安装...