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

相关内容

热门资讯

实测必看!竞技联盟破解版最新版... 1、实测必看!竞技联盟破解版最新版,pokernow辅助工具,黑科技教程(有挂攻略)2、进入游戏-大...
最新技巧!wepoker辅助真... 1、最新技巧!wepoker辅助真的假的,aapoker插件,可靠技巧(有挂透视);详细教程。2、w...
一分钟快速了解!wepoker... 一分钟快速了解!wepoker有机器人吗,德州透视插件,曝光教程(有挂透明)1、很好的工具软件,可以...
专业讨论!wpk辅助软件,hh... 1、专业讨论!wpk辅助软件,hhpoker有没有辅助,2025新版总结(有挂攻略);详细教程。2、...
实测教程!wpk俱乐部辅助器,... 实测教程!wpk俱乐部辅助器,拱趴大菠萝万能辅助器,插件教程(有挂教程)1、点击下载安装,微扑克wp...
科技通报!wepoker辅助工... 科技通报!wepoker辅助工具,aapoker脚本,曝光教程(有挂攻略);最新版2024是一款经典...
实测发现!wepoker破解游... 实测发现!wepoker破解游戏盒子,hardrock作弊,安装教程(有挂透视);最新版2024是一...
攻略讲解!aapoker透视脚... 攻略讲解!aapoker透视脚本入口,wepoker有没有透视方法,可靠教程(有挂攻略)是一款可以让...
每日必看!拱趴大菠萝开挂方法,... 1、每日必看!拱趴大菠萝开挂方法,wepoker辅助器官方,安装教程(有挂辅助)(UU poker、...
专业讨论!哈糖大菠萝能开挂吗,... 专业讨论!哈糖大菠萝能开挂吗,wepoker私人局辅助,我来教教你(有挂软件);建议优先通过哈糖大菠...