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

相关内容

热门资讯

WPK真假!德州扑克工具透视a... WPK真假!德州扑克工具透视ai,约局吧开挂,果然真的是有ai透视手册暗藏猫腻,小编详细说明约局吧开...
WPK控制牌!微扑克方法开挂a... WPK控制牌!微扑克方法开挂ai,德普之星私人局辅助免费,确实存在有ai开挂方式1、金币登录送、破产...
WPK真假!智星菠萝德州神器透... 您好,德州来玩辅助器这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多玩家...
WPK购买!WePoKer攻略... WPK购买!WePoKer攻略透视ai,hardrock作弊,其实真的有ai透视步骤;1、很好的工具...
WPK透视!WePoKer工具... WPK透视!WePoKer工具透视挂ai,红龙poker辅助工具,原来是真的有ai透视挂烘培1、红龙...
WPK多开!红龙PoKerap... WPK多开!红龙PoKerapp透视挂ai,德普之星私人局透视,竟然是有ai透视挂项目1、用户打开应...
WPK插件!智星菠萝德州攻略透... WPK插件!智星菠萝德州攻略透视挂ai,红龙poker辅助工具,切实存在有ai透视挂法子1、红龙po...
WPK辅助器!微扑克工具开挂a... WPK辅助器!微扑克工具开挂ai,德州私人局怎么透视,一贯是有ai开挂指引该软件可以轻松地帮助玩家将...
WPK脚本!德扑之星技巧透视a... WPK脚本!德扑之星技巧透视ai,佛手在线大菠萝智能辅助器,其实真的是有ai透视办法1、佛手在线大菠...
WPK有透视!红龙扑克技巧开挂... 您好,AApoker底牌这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多...