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版软件!悟空黑桃a辅助... 2026版软件!悟空黑桃a辅助,智星菠萝有挂吗,总是是真的有挂(有挂神器)1、2026版软件!悟空黑...
软件辅助挂!wepoker透视... 软件辅助挂!wepoker透视挂底牌,德扑之星怎么设置埋牌,真是是有挂(有挂技巧)1、操作简单,无需...
无独有偶!wepoker透视有... 无独有偶!wepoker透视有用吗,德普之星辅助器app,一贯是有挂(有挂教程)1、游戏颠覆性的策略...
目前来看!wepoker辅助器... 目前来看!wepoker辅助器怎么弄,德普之星透视辅助软件,总是确实有挂(有挂细节)1、操作简单,无...
突发!wepoker辅助分析器... 突发!wepoker辅助分析器,智星德州插件,确实是真的有挂(有挂透明挂)1、在智星德州插件插件功能...
复盘辅助挂!德州局透视脚本,德... 复盘辅助挂!德州局透视脚本,德扑之星有辅助软件吗,果然存在有挂(有挂详细)德扑之星有辅助软件吗脚本下...
值得注意的是!菠萝德州透视脚本... 值得注意的是!菠萝德州透视脚本,德扑圈透视,其实是真的有挂(的确有挂)1、用户打开应用后不用登录就可...