0

I am looking to run commands I typically would run through Heroku CLI via a python script, namely:

heroku pg:backups:capture

Historically, for running Heroku commands in Python I have used Heroku3.py, which works for me for things like restarting dynos. I am having difficulty finding a way to execute commands for addons, such as the one listed above.

Is there a way to call CLI commands through python?

JayBee
  • 540
  • 1
  • 5
  • 22
  • 1
    The Heroku CLI commands are no different than any other command-line / shell commands. So the solutions here should solve your problem: [How to execute a program or call a system command?](https://stackoverflow.com/questions/89228/how-to-execute-a-program-or-call-a-system-command). Unless you already tried those but are failing, in that case, you'll need to clarify what _specifically_ is the "difficulty" you are facing. – Gino Mempin Nov 06 '21 at 02:23
  • 1
    ...or if you need to also capture the output: [Running shell command and capturing the output](https://stackoverflow.com/q/4760215/2745495) – Gino Mempin Nov 06 '21 at 02:24
  • 1
    ...or you can reimplement Heroku3.py yourself by calling [Heroku's REST APIs](https://devcenter.heroku.com/articles/platform-api-reference) – Gino Mempin Nov 06 '21 at 02:28

0 Answers0