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

相关内容

热门资讯

技术分享!九九山城万州版脚本,... 技术分享!九九山城万州版脚本,wejoker免费脚本,必备教程(有挂解密);是一款可以让一直输的玩家...
科普!新超凡辅助,约局吧开挂神... 科普!新超凡辅助,约局吧开挂神器是真的吗,必赢教程(有挂讲解);新超凡辅助免费下载原版,在新超凡辅助...
专业讨论!哥哥打大a辅助工具靠... 专业讨论!哥哥打大a辅助工具靠谱嘛,wepoker透视器免费,解说技巧(有挂神器)是一款可以让一直输...
一起来讨论!大唐撸麻雀作弊码,... 一起来讨论!大唐撸麻雀作弊码,wepoker免费脚本咨询,揭秘教程(有挂总结);人气非常高,ai更新...
一分钟揭秘!三加一辅助,wep... 一分钟揭秘!三加一辅助,wepoker有没有插件,系统教程(有挂工具)是一款可以让一直输的玩家,快速...
揭秘攻略!海贝之城辅助器,aa... 揭秘攻略!海贝之城辅助器,aapoker辅助插件工具,2025新版总结(确实有挂);海贝之城辅助器简...
我来分享!创思维激k看底牌辅助... 【福星临门,好运相随】;我来分享!创思维激k看底牌辅助,约局吧怎么看有没有挂,安装教程(揭秘有挂);...
玩家必看攻略!边锋游戏小程序辅... 《玩家必看攻略!边锋游戏小程序辅助器免费,hhpoker可以控制吗,实用技巧(有挂透视)》 边锋游戏...
解密关于!三哥玩app辅助,哈... 解密关于!三哥玩app辅助,哈糖大菠萝辅助器,透视教程(讲解有挂);1、许多玩家不知道哈糖大菠萝辅助...
最新研发!大唐辅助软件,wep... 【福星临门,好运相随】;最新研发!大唐辅助软件,wepoker辅助器下载,AI教程(有挂教程);暗藏...