Skip to main content

Does anyone have some sample code to upload a file with Python SDKGEN? (nothing fancy, just an small file, so I don’t need multipart uploads, etc).  I see the following in the docs :

parent_client.uploads.upload_file(
UploadFileAttributes(
name=get_uuid(), parent=UploadFileAttributesParentField(id="0")
),
generate_byte_stream(1024 * 1024),
)

This seems overly complex and I’m not sure how to implement it. Do I really need the generate_bye_steam line? why? And am I supposed to import the UploadFileAttributes and UploadFileAttributesParentField functions and call them? Yuck. In the old SDK I just did this:

new_file = box_client.folder(OUTPUT_FOLDERID).upload(file_name)

Be the first to reply!

Reply