'BoxSDK Python - get shared link response isn't what is expected

-- App Objective --

I'm writing a python app to upload a file to a particular folder and then get a shared link to the file. This is a using the BoxSDK (pip install boxsdk).

-- Setup --

Python 3.8.5 (via anaconda)

Windows 64bit

-- References and Attempts --

I'm referencing Box's Developer site to get me going: https://developer.box.com/reference/get-files-id--get-shared-link/

I've successfully setup a client, uploaded a file, and called the method to get the file id to check that the file_id is what I expect it to be.

boxFile = self.client.file(file_id).get()

And the response is <Box File - 913405249779 (test.zip)> This matches the id in the url using the web app.

However, when I try to get the shared link, using the example code on Box's dev site

boxFile = self.client.file(file_id).get().shared_link
return boxFile['url']

boxFile is None (which makes sense given the output of .get()) and the return is subsequently None as well.

-- Question --

What am I missing?

I've looked around the web for several days trying to find more example code without success.

I really appreciate any help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source