D96 and D97 #100DaysOfCode

D96 and D97 #100DaysOfCode. Only three days left! I added the ability to my Digital Ocean Manager where you can now see the Public IPs on droplets.

Read Time53Seconds

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"))
            bar()

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.

https://github.com/Techdox/digitalocean-manager/blob/master/main.py

0 0
Happy
Happy
0.00 %
Sad
Sad
0.00 %
Excited
Excited
0.00 %
Sleppy
Sleppy
0.00 %
Angry
Angry
0.00 %
Surprise
Surprise
100.00 %

Leave a Reply

Your email address will not be published. Required fields are marked *

Close