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

相关内容

热门资讯

黑科技辅助!wepoke软件靠... 您好,wepoke软件靠谱这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很多玩...
黑科技辅助!wepoke插件,... 黑科技辅助!wepoke插件,(WePoKe有规律)原来真的有挂,辅助教程(有挂透视)-哔哩哔哩是一...
黑科技辅助!wepoke黑科技... 黑科技辅助!wepoke黑科技是啥,(wepoke德州扑克)原来真的有挂,详细教程(有挂分享)-哔哩...
一分钟了解!gg扑克有假,(扑... 一分钟了解!gg扑克有假,(扑克时间)原来真的有挂,软件教程(了解有挂)-哔哩哔哩;一分钟了解!gg...
黑科技辅助!wepoke私人局... 您好,wepoke私人局有挂这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很多...
科普攻略!微扑克辅牌器,(新微... 科普攻略!微扑克辅牌器,(新微扑克)原来真的有挂,可靠技巧(有挂解惑)-哔哩哔哩是一款可以让一直输的...
黑科技辅助!wepoke有辅助... 黑科技辅助!wepoke有辅助软件,(WePoKe能胜)原来真的有挂,必胜教程(有挂详情)-哔哩哔哩...
黑科技辅助!wepoke软件透... 黑科技辅助!wepoke软件透明挂合法,(WePoKe胜率)原来真的有挂,系统教程(有挂规律)-哔哩...
黑科技辅助!WePoKe透明挂... 您好:WePoKe透明挂这款游戏可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌都会发现很多用户的...
分享个大家!云扑克是否有外挂,... 分享个大家!云扑克是否有外挂,(云扑克软件)原来真的有挂,新2025版(真实有挂)-哔哩哔哩是一款可...