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透视工作室(辅助挂)竟然有挂(有挂透视辅助攻略)脚本下载中分为三种模型:挂靠谱的...
来一盘!佛手大菠萝辅助(辅助挂... 来一盘!佛手大菠萝辅助(辅助挂)果然存在有挂(有挂秘笈辅助脚本)1、任何透视是真的假的的玩家都可以机...
总算了解!hhpkoer辅助器... 总算了解!hhpkoer辅助器视频(辅助挂)原来有挂(真是有挂辅助app)1、许多玩家不知道辅助怎么...
必备辅助推荐!wepoker私... 您好,这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多玩家在这款游戏中打...
教程攻略!wepoker是不是... 教程攻略!wepoker是不是有人用挂(辅助挂)竟然真的是有挂(有挂分析辅助app)1、用户打开应用...
今日重大通报!wepoker私... 今日重大通报!wepoker私人局透视方法(辅助挂)竟然有挂(真的有挂辅助方法)进入游戏-大厅左侧-...
总算明白!xpoker辅助器(... 总算明白!xpoker辅助器(辅助挂)都是是有挂(有挂规律辅助技巧)脚本下载中分为三种模型:挂靠谱的...
今日科普!wpk刷入池率脚本(... 今日科普!wpk刷入池率脚本(辅助挂)好像真的是有挂(有挂详细辅助脚本)亲,关键说明,透视脚本安卓赛...
分享认知!xpoker怎么作弊... 分享认知!xpoker怎么作弊(辅助挂)真是是真的有挂(证实有挂辅助方法)1、打开软件启动之后找到中...
终于知道!德普之星app安卓版... 终于知道!德普之星app安卓版破解版(辅助挂)果然有挂(的确有挂辅助器)辅助器是一种具有地方特色的麻...