File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
Create_And_Manage_Heroku_App Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ import heroku3
2
+
3
+ def create_heroku_app (app_name ):
4
+ heroku_conn = heroku3 .from_key ('YOUR_HEROKU_API_KEY' ) # Replace with your Heroku API key or use heroku3.from_key(heroku_api_key)
5
+ app = heroku_conn .create_app (name = app_name )
6
+ return app
7
+
8
+ def list_heroku_apps ():
9
+ heroku_conn = heroku3 .from_key ('YOUR_HEROKU_API_KEY' ) # Replace with your Heroku API key or use heroku3.from_key(heroku_api_key)
10
+ apps = heroku_conn .apps ()
11
+ return apps
12
+
13
+ def delete_heroku_app (app_name ):
14
+ heroku_conn = heroku3 .from_key ('YOUR_HEROKU_API_KEY' ) # Replace with your Heroku API key or use heroku3.from_key(heroku_api_key)
15
+ app = heroku_conn .apps ().get (app_name )
16
+ if app :
17
+ app .delete ()
18
+ print (f"App '{ app_name } ' deleted successfully." )
19
+ else :
20
+ print (f"App '{ app_name } ' not found." )
21
+
22
+ def main ():
23
+ app_name = input ("Enter the name of the Heroku app: " )
24
+
25
+ # Create a new Heroku app
26
+ new_app = create_heroku_app (app_name )
27
+ print (f"Heroku app '{ new_app .name } ' created successfully." )
28
+
29
+ # List all Heroku apps
30
+ print ("\n List of all Heroku apps:" )
31
+ apps = list_heroku_apps ()
32
+ for app in apps :
33
+ print (app .name )
34
+
35
+ # Delete a Heroku app
36
+ delete_app = input ("Enter the name of the app to delete: " )
37
+ delete_heroku_app (delete_app )
38
+
39
+ if __name__ == "__main__" :
40
+ main ()s
Original file line number Diff line number Diff line change
1
+ # Create_And_Manage_Heroku_Apps
2
+
3
+ Short description of package/script
4
+
5
+ - This Script Was simple to setup
6
+ - Need import heroku3
7
+
8
+ ## Setup instructions
9
+
10
+ Just Need to run this command " pip install heroku3 "
11
+ then run the Create_And_Manage_Heroku_Apps.py file and for running python3 is must be installed!
12
+
13
+ ## Detailed explanation of script, if needed
14
+
15
+ This Script Is Only for Create and manage Heroku apps use only!
You can’t perform that action at this time.
0 commit comments