Connect to remote node using Python and Bitcoin RPC

Hi. I want to basically recreate the following API:

https://medium.com/@peterjd42/build-your-own-bitcoin-api-using-node-js-and-bitcoin-core-251e613623db

However, as you can see, the connection is done locally. I want to do this remotely. Any ideas?