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 可以获取具体的项目消费概要。

相关内容

热门资讯

WPK真假透视挂操作!有哪些免... WPK真假透视挂操作!有哪些免费的wpk作弊码,红龙PoKerai多功能透视挂工具1、有哪些免费的w...
细节方法辅助!聚游广东麻将ai... 很多人使用云端 AI 时,都担心聚游广东麻将、内部资料上传带来隐私风险。这款本地运行的 AI 黑科技...
WPK俱乐部辅助指引!wpk作... WPK俱乐部辅助指引!wpk作弊最怕三个东西,德扑之星ai多功能辅助app1、很好的工具软件,可以解...
查到实测辅助器!科乐四平麻将a... 您好:科乐四平麻将这款游戏可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌都会发现很多用户的牌特别...
WPK透视透视挂绝活儿!wep... 您好,wepoker软件辅助程序这款游戏可以开挂的,确实是有挂的,需要了解加去威信【13670430...
揭秘几款辅助器!大众互娱ai辅... 一款 AI 游戏攻略黑科技工具上线,查攻略效率直接开挂。它整合版本更新、装备搭配、BOSS 打法、牌...
WPK模拟器辅助器积累!wep... WPK模拟器辅助器积累!wepoker究竟有没有透视,智星菠萝德州ai多功能辅助器教程1、金币登录送...
总结教程辅助器!丫丫棋牌ai辅... 本地部署 AI 黑科技工具迎来新版本,不用上传文件到云端就能完成丫丫棋牌解析、 AI 处理、丫丫棋牌...
WPK私人局辅助教程书!wep... WPK私人局辅助教程书!wepoker高级辅助,wpkai多功能辅助技巧1、用户打开应用后不用登录就...
盘点几款透视挂!银河麻将ai透... 一款 AI 游戏攻略黑科技工具上线,查攻略效率直接开挂。它整合版本更新、装备搭配、BOSS 打法、牌...