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辅助有... 1、黑科技新版!wepoke辅助有挂吗(黑科技ai)固有是有挂(有挂规律)-哔哩哔哩;详细教程。2、...
黑科技挂!aapoker有外挂... 黑科技挂!aapoker有外挂,德扑起手牌胜率图,德州论坛(有挂辅助挂)-哔哩哔哩是一款可以让一直输...
黑科技机器人!德州之星插件,w... 黑科技机器人!德州之星插件,wepoke用模拟器,必赢方法(有挂介绍)-哔哩哔哩1、不需要AI权限,...
黑科技线上!wepoke小技巧... 1、黑科技线上!wepoke小技巧(智能ai)其实是有挂(有挂长期)-哔哩哔哩2、进入游戏-大厅左侧...
黑科技ai代打!wpk德州ai... 黑科技ai代打!wpk德州ai辅助神器,微扑克游戏辅助器,存在挂教程(有挂总结)-哔哩哔哩1、金币登...
黑科技安装!德扑之星ai代打可... 黑科技安装!德扑之星ai代打可靠吗(黑科技ai)固有存在有挂(有挂ai代打)-哔哩哔哩是一款可以让一...
黑科技ai辅助!Wpk辅助器,... 1、黑科技ai辅助!Wpk辅助器,微扑克wpk透视辅助,新版2025教程(有挂攻略)-哔哩哔哩;代表...
黑科技游戏!云扑克辅助软件(智... 黑科技游戏!云扑克辅助软件(智能ai)果然有挂(有挂最新款)-哔哩哔哩;《WPK辅助透视》‌:支持手...
黑科技ai!微扑克辅助透视技能... 黑科技ai!微扑克辅助透视技能教程,德扑之星软件有猫腻吗,必赢方法(有挂规律)-哔哩哔哩,您好,微扑...
黑科技私人局!wpk辅助插件(... 黑科技私人局!wpk辅助插件(智能ai)原先有挂(有挂私人局)-哔哩哔哩;科技安装教程;136704...