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

相关内容

热门资讯

外挂秘籍!pokerworld... 外挂秘籍!pokerworld软件,哈糖大菠萝可以开挂吗-一贯存在有辅助方法(哔哩哔哩)1、下载好哈...
外挂课程!拱趴大菠萝机器人,竞... 外挂课程!拱趴大菠萝机器人,竞技联盟透视-总是是有辅助技巧(哔哩哔哩)1、首先打开拱趴大菠萝机器人辅...
外挂法门!we poker免费... 外挂法门!we poker免费辅助器,悦扑克脚本-一贯真的有辅助软件(哔哩哔哩);小薇(辅助器软件下...
外挂教程书!约局吧app有挂吗... 外挂教程书!约局吧app有挂吗,约局吧是否有挂-切实是有辅助软件(哔哩哔哩)1)约局吧app有挂吗免...
外挂烘培!约局吧德州有挂吗,智... 外挂烘培!约局吧德州有挂吗,智星菠萝透视-本来真的是有辅助插件(哔哩哔哩)1、外挂烘培!约局吧德州有...
外挂课程!poker红龙辅助,... 外挂课程!poker红龙辅助,德普之星透视辅助插件-确实真的是有辅助技巧(哔哩哔哩)1、poker红...
外挂办法!拱趴大菠萝自动计算机... 外挂办法!拱趴大菠萝自动计算机器人,德普之星私人局透视-确实真的是有辅助app(哔哩哔哩);拱趴大菠...
外挂技法!约局吧开挂神器是真的... 外挂技法!约局吧开挂神器是真的吗,xpoker怎么作必弊-一贯存在有辅助攻略(哔哩哔哩)1、许多玩家...
外挂法子!德州透视是真的吗,哈... 外挂法子!德州透视是真的吗,哈糖大菠萝破解器-一贯存在有辅助app(哔哩哔哩)1、玩家可以在德州透视...
外挂秘籍!大菠萝手游辅助,哈糖... 外挂秘籍!大菠萝手游辅助,哈糖大菠萝挂法-竟然真的是有辅助教程(哔哩哔哩)一、大菠萝手游辅助游戏安装...