D96 and D97 #100DaysOfCode

I hope everyone had a good Christmas! I did have a few Rums and didn’t get a post out, but it’s Christmas after all.

Anyway, I found a way to print my Droplet information, so now after creating a new droplet, I can see it’s IP address and then connect to it all without hitting the console.

    def dropletsLog():
        with alive_bar() as bar:
            for droplet in my_droplets:
                print(f"Pulling logs for {droplet}")
                print(f" NAME: {droplet.name}, Public IP:{droplet.ip_address}, DROPLET STATUS:{droplet.status}", file=open("droplet_events.txt", "a"))

As you can see it’s a pretty simple thing to do, using the DigitalOcean library it’s just a matter of finding what data you want to pull from each droplet.


I’m happy I can do it this way rather than having to do requests, which can be pretty messy.

Now today/tomorrow’s task will be to create a delete function.

If you want to see the full code, check it out here.


Written on December 26, 2019