简体   繁体   中英

Forge - inconsistent output from python script and terminal command

I am following this tutorial to convert a .sldprt to .obj file. I wanted to accomplish this conversion using a python script, and I found a script online that accomplishes this to the point where it uploads the file to the server and begins the conversion. In step 3 of the tutorial (Verify the job is Complete), when I type the following command into the command line:

curl -X 'GET' -H 'Authorization: Bearer MYTOKEN' -v 'https://developer.api.autodesk.com/modelderivative/v2/designdata/MYURN/manifest'

I get an appropriate response (see image below):

However, doing the same thing from Python script gives me the following output:

在此处输入图片说明

My Python script is as below:

### Verify if translation is complete and get the outURN
url = BASE_URL + 'modelderivative/v2/designdata/' + urn + '/manifest'
headers = {
    'Authorization' : 'Bearer ' + ACCESS_TOKEN
}
r = requests.get(url, headers=headers)
content = eval(r.content)
print("==========================================")
print(content)
print("==========================================")

I have no idea whats the difference between the two (terminal command and the command given from python script). Can someone point out what the problem here is?

或者更好的方法是,侦听extract.finished事件,该事件通知翻译何时完成。

I believe I had to pause for some time after beginning the conversion to allow some time for the cloud to convert .sldprt to .stl. The solution is constantly poll the 'status' key and proceed only when the status changes from 'pending' to 'success'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM