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

相关内容

热门资讯

免费测试版!hhpoker作弊... 免费测试版!hhpoker作弊实战视频,微扑克辅助,其实有挂(有挂讲解)1、辅助软件下载优化,底牌透...
黑科技技巧!hhpoker的辅... 黑科技技巧!hhpoker的辅助是真的吗,德普之星透视辅助软件是真的吗,都是存在有挂(有挂技术)1、...
研究成果!we poker辅助... 研究成果!we poker辅助器,pokemmo辅助器手机版下载,真是是有挂(有挂功能);破解侠是真...
今日!wepoker轻量版透视... 今日!wepoker轻量版透视,智星德州有脚本吗,其实真的是有挂(有挂解密)智星德州有脚本吗脚本下载...
指导大家!红龙poker有辅助... 指导大家!红龙poker有辅助吗,hhpoker作弊实战视频,好像存在有挂(有挂详情)1、下载好透视...
迎来新发展!hhpoker怎么... 迎来新发展!hhpoker怎么防作弊,德扑之星辅助工具如何打开,真是存在有挂(竟然有挂);1)德扑之...
推荐一款!wepoker透视脚... 推荐一款!wepoker透视脚本免费下载,aapoker怎么拿好牌,一直真的有挂(讲解有挂)小薇(辅...
据报道!德普之星透视免费,德普... 据报道!德普之星透视免费,德普之星怎么开辅助,切实真的是有挂(有挂细节)1、全新机制【德普之星怎么开...
每日必看推荐!pokermas... 每日必看推荐!pokermaster脚本,智星德州插件,果然是真的有挂(有挂方法)1、玩家可以在透视...
受玩家影响!wepoker免费... 受玩家影响!wepoker免费脚本弱密码,德普软件,总是是真的有挂(有挂神器)1、任何德普软件透视是...