Archives

There are several tools out there for interacting with SharePoint through a Python script, but today, I am going to demonstrate a very simple way to upload a file to your SharePoint environment with minimal overhead. This can be useful for users running on Linux environments, such as a Raspberry PI, who want to script some functionality.

Using Octoprint to Monitor 3D Printing

I recently set up a tool called Octoprint on a Raspberry Pi, and am using it to control and monitor the 3D printer here at DMC.

The tool generates timelapses after each print, and it started to take up a lot of space on the Pi’s storage.

I used the following script to take newly rendered timelapses and upload them to SharePoint. This allows users to easily access their print timelapses and frees space on the pi.

Setup

You will need to install the requests package and NTLM authentication package on your environment. In a Linux environment, type the following commands:

After uploading the document, you'll need to make a separate call to update the document metadata. The "uploadResult" variable should contain the ID of the new document. Please use the following resource to update the list item (pass the ID to the url)

I realize this was posted a year ago, but I hope you can offer me a little guidance. I was able to work through this snippet and get a document uploaded to SharePoint, now I am looking for how to send over the other fields we have for the document library. Any help would be greatly appreciated.

Sounds like there is an issue when you are attempting to get SharePoint context info (line 23). Please examine the value of r.json() to see what the specific error is. It is likely due to invalid credentials.