0

I am trying to upload a .rvt to BIM360 docs. I can successfully get through step 5 in this link, but once I get there, things go wrong. If I upload a .zip or some other format, I can get through step 6. If I try a .rvt, the response tells me that 'processState': 'NEEDS_PROCESSING', and the publish log in BIM360 Docs says 'Extraction Failed'. I've tried multiple .rvt files of varying sizes, and it's always the same. If I try to upload using the '/resumable' PUT request, it fails as well. Any help would be appreciated. Relevant code:

def read_file_chunks(open_file, chunk_size = 3145728):
    while True:
        data = open_file.read(chunk_size)
        if not data:
            break
        yield data

def upload_to_storage(bucket_key, object_name, filepath, filename):
    upload_url = forge_base + forge_bucket + '/' + bucket_key + '/objects/' + urllib.parse.quote(object_name) + '/resumable'
    bare_token3 = token3.get('Authorization')
    session_id = uuid.uuid1()
    upload_file = filepath + filename
    file_size = os.path.getsize(upload_file)
    open_file = open(upload_file, 'rb')
    index = 0
    for chunk in read_file_chunks(open_file):
        offset = index + len(chunk)
        print (offset)
        content_type = 'application/octet-stream'
        content_length = str(file_size)
        print (content_length)
        content_range = 'bytes %s=%s/%s'% (index, offset, file_size)
        print (content_range)
        index = offset
        upload_header = {'Authorization': bare_token3, 'Content-Type': content_type, 'Content-Length': content_length, 'Content-Range': content_range, 'Session-Id': str(session_id)}
        print (upload_header)
        upload_response = requests.put(upload_url, headers=upload_header, data=chunk)
        print (upload_response)
    return upload_response.json()
  • Hi Andrew, assume the file can be processed if by UI only, the highly possibility would be the source file has not been uploaded to storage correctly if by UI. Could you check the sha1 parameter in response of uploading if it is same to your source file? you can get sha1 of local file by some methods such as https://stackoverflow.com/questions/22058048/hashing-a-file-in-python – Xiaodong Liang May 06 '20 at 14:38
  • if this does not help, could you share a demo source file and code for us to diagnose? Please send them through forge.help@autodesk.com with private demo data. – Xiaodong Liang May 06 '20 at 14:39
  • So, it turns out that in the content_range line, I had an = instead of a -. It took me way too long to actually catch that. – Andrew Urban May 06 '20 at 21:16
  • Thank you for sharing the finding! I did not notice at the beginning. – Xiaodong Liang May 08 '20 at 02:14

0 Answers0