AutodeskForgeNETWORK_FILE_NOT_FOUND
创始人
2024-11-12 10:30:19
0

当使用Autodesk Forge API时,可能会出现NETWORK_FILE_NOT_FOUND错误。这意味着API无法找到指定的文件。要解决此问题,您应该检查文件的位置和命名,并确保在API调用中正确指定了文件路径。以下是一个Python代码示例,演示如何上传文件到Forge并正确指定文件路径:

import requests
import json
import os

# 设置Forge API的访问令牌
ACCESS_TOKEN = ""

# 指定要上传的文件路径和名称
file_name = "example.dwg"
file_path = os.path.abspath(file_name)
file_url = "https://developer.api.autodesk.com/oss/v2/buckets//objects/" + file_name

# 将文件上传到Forge
headers = {
    "Authorization": "Bearer " + ACCESS_TOKEN,
    "Content-Type": "application/octet-stream",
    "x-ms-blob-type": "BlockBlob"
}
with open(file_path, "rb") as f:
    data = f.read()
response = requests.put(file_url, headers=headers, data=data)

# 检查上传是否成功
if response.status_code == 200:
    print("File uploaded successfully!")
else:
    print("Error uploading file:", response.content)

# 指定上传后的文件ID和名称
file_id = ""
file_name = "example.dwg"

# 指定要使用的Forge API endpoint
url = "https://developer.api.autodesk.com/modelderivative/v2/designdata/job"

# 指定要使用的转换类型
outputs = [
    {
        "type": "svf",
        "views": ["2d", "3d"]
    }
]

# 指定API调用中使用的参数
data = {
    "input": {
        "urn": "urn:adsk.objects:os.object:/" + file_name
    },
    "output": {
        "formats": outputs
    }
}

# 执行API调用
headers = {
    "Authorization": "Bearer " + ACCESS_TOKEN,
    "Content-Type":

相关内容

热门资讯

透视游戏"wepok... 透视游戏"wepoker有透视底牌吗"hhpoker视频巡查真的假的(真是真的是有辅助神器)-哔哩哔...
此事备受玩家关注"w... 此事备受玩家关注"wepoker破解版内购"hhpoker到底可以作必弊码(一贯存在有辅助下载)-哔...
透视科技"wepok... 透视科技"wepoker透视脚本免费app"hh poker透视器下载(其实真的有辅助神器)-哔哩哔...
随着"拱趴大菠萝机器... 随着"拱趴大菠萝机器人"pokemmo脚本辅助器下载(总是是有辅助工具)-哔哩哔哩1、任何pokem...
透视美元局"约局吧游... 透视美元局"约局吧游戏挂"pokermaster修改器(好像真的是有辅助下载)-哔哩哔哩进入游戏-大...
透视总结"德普辅助器... 透视总结"德普辅助器怎么用"智星德州有脚本吗(好像存在有辅助修改器)-哔哩哔哩1、完成德普辅助器怎么...
透视美元局"德州透视... 透视美元局"德州透视竞技联盟"德普之星透视(都是存在有辅助平台)-哔哩哔哩1、这是跨平台的德州透视竞...
透视规律"hhpok... 透视规律"hhpoker辅助软件是真的么"wepoker的辅助器(原来真的是有辅助平台)-哔哩哔哩;...
透视神器"fishp... 透视神器"fishpoker透视底牌"wepoker有没有机器人(一直真的是有辅助app)-哔哩哔哩...
连日来"智星德州插件... 连日来"智星德州插件2024最新版"wepoker有没有机器人(一直真的是有辅助工具)-哔哩哔哩1、...