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、每一步都需要思考,不...
此事备受玩家关注!赣南好友辅助... 此事备受玩家关注!赣南好友辅助!其实真的有开挂辅助插件(详细教程)-哔哩哔哩1、不需要AI权限,帮助...
总结辅助挂!小闲川南手游辅助器... 总结辅助挂!小闲川南手游辅助器!好像真的是有开挂辅助教程(有挂规律)-哔哩哔哩1、下载好小闲川南手游...
据权威媒体报道!决战平安京辅助... 您好,决战平安京辅助软件这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多...
据了解!方片十三张辅助器软件!... 据了解!方片十三张辅助器软件!切实真的是有开挂辅助挂(有挂细节)-哔哩哔哩1、任何方片十三张辅助器软...
第三方技巧!小旋风辅助器!其实... 第三方技巧!小旋风辅助器!其实确实有开挂辅助脚本(果真有挂)-哔哩哔哩1、小旋风辅助器免费辅助多个强...
近年来!中至余干麻将有没有挂!... 近年来!中至余干麻将有没有挂!真是真的有开挂辅助方法(有挂总结)-哔哩哔哩1、金币登录送、破产送、升...
黑科技辅助挂!茶馆儿破解教程!... 黑科技辅助挂!茶馆儿破解教程!本来是有开挂辅助方法(有挂功能)-哔哩哔哩一、茶馆儿破解教程可以开透视...
明白辅助挂!欢乐茶馆怎么能赢!... 明白辅助挂!欢乐茶馆怎么能赢!真是是有开挂辅助脚本(有挂透明挂)-哔哩哔哩1)欢乐茶馆怎么能赢辅助插...
目前来看!雀神山庄辅助器!一贯... 目前来看!雀神山庄辅助器!一贯真的有开挂辅助技巧(有挂实锤)-哔哩哔哩1、雀神山庄辅助器模拟器是什么...