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

相关内容

热门资讯

一分钟了解!红龙poker辅助... 一分钟了解!红龙poker辅助挂多功能透视工具,一贯是真的有挂(真的有挂)1)红龙poker辅助插件...
玩家必备科技!德扑圈辅助挂多功... 玩家必备科技!德扑圈辅助挂多功能透视工具,都是是真的有挂(证实有挂)1、完成德扑圈有辅助插件,帮助玩...
分享一款!智星德州扑克辅助挂多... 分享一款!智星德州扑克辅助挂多功能透视工具,总是真的是有挂(有挂透明挂)1、不需要AI权限,帮助你快...
玩家必用!wpk辅助挂多功能透... 玩家必用!wpk辅助挂多功能透视工具,总是是有挂(有挂秘笈)1.wpk 选牌创建新账号,点击进入游戏...
今日头条!德扑之星辅助挂多功能... 今日头条!德扑之星辅助挂多功能透视工具,真是是真的有挂(有挂猫腻)1、德扑之星模拟器是什么优化,德扑...
重大消息!德普之星辅助挂多功能... 重大消息!德普之星辅助挂多功能透视工具,原来存在有挂(有挂头条)1、德普之星免费脚本咨询教程、德普之...
重大消息!wpk辅助挂多功能透... 重大消息!wpk辅助挂多功能透视工具,确实真的是有挂(有挂技术)1、游戏颠覆性的策略玩法,独创攻略技...
解密关于!wepoker辅助挂... 解密关于!wepoker辅助挂多功能透视工具,一贯是真的有挂(有挂规律)1、wepoker辅助器安装...
发现玩家!AAPoKer辅助挂... 发现玩家!AAPoKer辅助挂多功能透视工具,总是是真的有挂(存在有挂)1)AAPoKer辅助插件:...
解密关于!AAPoKer辅助挂... 解密关于!AAPoKer辅助挂多功能透视工具,竟然存在有挂(有挂教程)1、实时AAPoKer透视辅助...