D93 #100DaysOfCode

Today I’ve been working more on my Digital Ocean App.

The idea of this app is to allow me to easily interact with my VMs without having to log in to the console and to let me play around with the APIs.

What I’ve done today is pulled my droplets (Virtual Machines) down into a list and then ran a for loop to get all the events for each droplet, see below code.

    import digitalocean
    import os
    API_SECRET = os.environ.get("TOKEN")
    manager = digitalocean.Manager(token=API_SECRET)
    my_droplets = manager.get_all_droplets()
    for droplet in my_droplets:
        print(droplet.get_events(), file=open("droplet_events.txt", "a"))

So as you can see I’m grabbing the events for each droplet and exporting the events to a text file, it’s nicer than having it all blasted in the terminal and lets me store it for later use.

I’m going to keep playing around with the APIs and then start working on making a droplet with my new app.

Written on December 22, 2019