Froge uploads rvt files

problem description

froge uploaded model, file transfer parameter exception.
first of all, I want to confirm whether there is a problem with downloading parameters. I can"t find which parameter the file stream is assigned to in the interface provided by froge.
next, let"s see if there is a problem with the code uploaded to the Python file.
has been bothering me for several days!

the environmental background of the problems and what methods you have tried

Python urllib2 Library

related codes

/ / Please paste the code text below (do not replace the code with pictures)
f = io.open (file_name, "rb")

    filebody = f.read()
    PostUrl = " https://developer.api.autodesk.com/oss/v2/buckets/"+bucketKey+"/objects/"+fileinfo.name
    postData={}
    postData = {"file": filebody}
    headers = {"Authorization":"Bearer "+token,"Content-Length":fileinfo._size}
    request = urllib2.Request(PostUrl)
    request.add_header("Authorization","Bearer "+token)
    request.add_header("Content-Length",fileinfo._size)
    request.add_data(filebody)
    request.get_method = lambda:"PUT"
    response = urllib2.urlopen(request)
    result = response.read()

what result do you expect? What is the error message actually seen?

Traceback (most recent call last):
File "D:ZZKJPROWuhanProsrcmodalManagerviews.py", line 698, in autodesk_up
loadfile

response = urllib2.urlopen(request)

File "C:Python27liburllib2.py", line 154, in urlopen

return opener.open(url, data, timeout)

File "C:Python27liburllib2.py", line 429, in open

response = self._open(req, data)

File "C:Python27liburllib2.py", line 447, in _ open

"_open", req)

File "C:Python27liburllib2.py", line 407, in _ call_chain

result = func(*args)

File "C:Python27liburllib2.py", line 1241, in https_open

context=self._context)

File "C:Python27liburllib2.py", line 1195, in do_open

h.request(req.get_method(), req.get_selector(), req.data, headers)

File "C:Python27libhttplib.py", line 1042, in request

self._send_request(method, url, body, headers)

File "C:Python27libhttplib.py", line 1082, in _ send_request

self.endheaders(body)

File "C:Python27libhttplib.py", line 1038, in endheaders

self._send_output(message_body)

File "C:Python27libhttplib.py", line 880, in _ send_output

msg += message_body

UnicodeDecodeError: "utf8" codec can"t decode byte 0xd0 in position 0: invalid c
ontinuation byte

Aug.12,2021

here are some Forge python articles,
python" rel=" nofollow noreferrer "> https://forge.autodesk.com/ca.

I wrote the basic process of implementing Forge Viewer in Python, and see if it can solve your problem
python" rel=" nofollow noreferrer "> https://forge.autodesk.com/bl.

.
Menu