By following Reverse engineer the Discourse API your python script should be able to do everything you can do by using UI.