Python script for uploading files to box using OAuth2
Hello Box team,
Some one please give me python script for uploading files to box ?
I know we have to interact with browser to get initial authentication.
I'm looking to script which accepts a folder containing files and upload's them to box location we prefer ?
Please help
-
Hi ,
Thanks for your post. Have you checked out our developer documentation here?
That may help you get started with uploads and other Box actions. Thanks for clarifying and checking out the link!
-
Unfortunately Box's API does not accept a folder as an input. You must create a folder and specify individual files for upload in separate requests.
You can see some excerpts here for uploading an individual file:
https://github.com/box/box-python-sdk/blob/master/docs/usage/files.md#upload-a-file
And creating a folder:
https://github.com/box/box-python-sdk/blob/master/docs/usage/folders.md#create-a-folder
If you are doing this through a front-end, you may wish to use our Content Uploader Javascript library:
https://developer.box.com/docs/box-content-uploader
Hope that helps! Let us know if you have any other questions!
Thanks,
Jason
-
Is there a way to make the upload function force overwrite of existing files? I'm currently getting the following error:
BoxAPIException: Message: Item with the same name already exists Status: 409 Code: item_name_in_use
Ideally, I would like for the file to be overwritten, and version number of the file incremented.
Please sign in to leave a comment.
Comments
5 comments