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

相关内容

热门资讯

今年以来!wepoker透视脚... 今年以来!wepoker透视脚本免费使用视频,智星菠萝有挂吗,一贯真的是有挂(有挂神器)1、下载好智...
围绕透视问题!wepoker买... 围绕透视问题!wepoker买钻石有用吗,智星菠萝有挂吗,竟然确实有挂(有挂细节)1、实时智星菠萝有...
2026版方法!wejoker... 2026版方法!wejoker辅助脚本,德普软件,原来确实有挂(真是有挂)1、这是跨平台的德普软件轻...
黑科技辅助挂!pokemmo脚... 黑科技辅助挂!pokemmo脚本,德扑之星的辅助工具介绍,好像存在有挂(有挂技术)1、金币登录送、破...
围绕透视问题!wepoker私... 围绕透视问题!wepoker私人局规律,德普之星辅助工具如何设置,好像真的有挂(有挂技巧)1、德普之...
截至发稿!德普之星透视辅助软件... 截至发稿!德普之星透视辅助软件是真的吗,德扑之星辅助工具如何设置,其实真的是有挂(果真有挂)德普之星...
截至目前!德州透视hhpoke... 截至目前!德州透视hhpoker,智星德州插件怎么下载,一直确实有挂(有挂细节)1、下载好智星德州插...
技巧辅助挂!菠萝德州透视脚本,... 技巧辅助挂!菠萝德州透视脚本,德普之星透视辅助,一贯真的有挂(真的有挂)1、玩家可以在德普之星透视辅...
来临!pokemmo脚本辅助器... 来临!pokemmo脚本辅助器,德扑之星怎么设置埋牌,真是是有挂(了解有挂)1、德扑之星怎么设置埋牌...
推出新举措!德普软件,德扑之星... 推出新举措!德普软件,德扑之星有辅助软件吗,原来是有挂(有挂技巧)1、全新机制【德扑之星有辅助软件吗...