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

相关内容

热门资讯

德州ai辅助有用!wpk的下风... 德州ai辅助有用!wpk的下风机制,微扑克辅助机器人,大神讲解(有挂详情)是一款可以让一直输的玩家,...
透视真的(wePOke)外挂透... 1、透视真的(wePOke)外挂透明挂辅助app(wepoke辅助技巧)原生真的是有挂(详细透视高科...
wpk有外挂!德州扑克ai机器... wpk有外挂!德州扑克ai机器人,wepoke里面有ai,解密教程(有挂总结)1、超多福利:超高返利...
透视实锤(wEPOKE)透明挂... 您好,wepoke辅助插件这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很多玩...
aapoker透明挂!智星德州... aapoker透明挂!智星德州辅助,wpk ai,切实教程(有挂规律)1、金币登录送、破产送、升级送...
透视安装(wepoKE)外挂透... 透视安装(wepoKE)外挂透明挂辅助工具(wepoke辅助有挂)本来真的有挂(详细透视安装教程);...
aapoker辅助!德州ai软... aapoker辅助!德州ai软件怎么收费,微扑克算正规平台,线上教程(有挂介绍)1)aapoker辅...
透视教程(wEpOke)透视辅... 透视教程(wEpOke)透视辅助插件(wepoke辅助)原来存在有挂(详细透视细节方法);wepok...
wepoke辅助插件!德扑之星... wepoke辅助插件!德扑之星软件透明软件,德州之星辅助可以用,微扑克教程(有挂技巧);人气非常高,...
透视代打(wepoKE)外挂透... 自定义wepoke辅助德之星系统规律,只需要输入自己想要的开挂功能,一键便可以生成出微扑克专用辅助器...