API's with OctoPrint

I am new to using octoprint and programming. I am looking to obtain certain values from octoprint such as the time left to print to display in some UI and do some commands based on the time left to print. The software I'm using to do the UI requires me to import an API Script. I don't know how to do that.

I have already done research on how I will be able to accomplish this and it requires me to use API. All I have access to is the API Key from the octoprint web interface and the API documentation. I went through the documentation but I don't know how to use the code provided there.

OctoPrint version - 1.3.12
OctoPi version - 0.16.0
Raspberry Pi 3B+
Windows 10

It will be similar to this.