Share your repls and programming experiences

← Back to all posts
Uptime Robot API (READ DESCRIPTION FOR USAGE INSTRUCTIONS)
h
Warhawk947 (552)

How this all came together

So, If you're like me, and you use the Repl.it Way of hosting discord bots, you use uptimerobot.com to track how your bots are doing.

Which is ok, but, well, you kind of have to type out "uptimerobot.com" in the search bar every single time you want to check on your bots.

Which is ok, but pretty soon you'll reduce your fingers into painful stubs because of overtyping.

Which is ok, but if you're like me and you bring your computer to school, you'll soon see that every single time you switch IP addresses, you'll have to re-login.

Which is ok, but pretty soon you'll start thinking of a better way.

And thats how UptimeRobotAPI was created - All in Vanilla Python!.

Usage Instructions

Step 1: A journey of a million miles begins with one step

Copy the entire contents of "main.py" into a file of your choosing. Then in your "main.py", to import the API, type the following:

from <file name> import Client

Step 2: Initiating the client

Next, to create the client, you'll have to get your API secret. Ooh, Scary!

Step 2.5

To get your API key, first go to uptimerobot.com. Then, go to your settings. Then, scroll all the way down until you see the header "API Settings". Go down to the sub-header "Main API Key" and click create the main API key, and then copy to clipboard

Step 3: Using the Client

After you got the API key in your clipboard, type the following:

client = Client(<your API key here>) # Initiates the client

Step 4: Using the Client cont.

Now, let's actually do something! Type the following code to list how many online monitors you have:

print(client.getAccountDetails()['account']['up_monitors'])

Wow, cool, right?

Step 5: Creating Monitors

Now, let's create a monitor! You know what to do...

client.newMonitor(<name>, <url to monitor>)

Woah! You're becoming an eXpErT HaCkER!

Step 6: Deleting, Pausing, and Resuming Monitors

Deleting, pausing, and resuming monitors is pretty straight forward.

client.<delete, pause, or resume>Monitor(<name>)

Step 7: Changing a Monitor's URL

Now for something different! To change a Monitor's URL, do the following:

client.changeMonitorUrl(<name>, <url>)

Simple, right?

Congratulations! You've learned everything about my UptimeRobotAPI! WOOHOO!!!!!!!!!!!!!!!!

Btw, I'll be making a discord bot with all of these features (and more!), so stay tuned!

OMG guys, thanks for the upvotes \(OwO)/

cheers, Warhawk947

Comments
hotnewtop
Dart (1185)

Isn’t it just easier to go to the website

Warhawk947 (552)

@Zexogon yeah but isn't it more fun to use this
cmon

sugarfi (626)

@Zexogon imagine using a web browser instead of curl and wget

Warhawk947 (552)

@sugarfi XD how could you even think about it

sugarfi (626)

@Warhawk947 imagine using curl and wget rather than compiling a c program with sys/socket.h whenever you need to access the internet

sugarfi (626)

@Warhawk947 imagine using sys/socket.h instead of writing raw machine code to access the NIC

sugarfi (626)

@Warhawk947 imagine writing machine code instead of building an NIC and hooking it up to your computer which you build from scratch and program with a magnetized needle

Coder100 (16903)

What is vanilla python?
Is it like vanilla javascript?
Which is what?

from Warhawk import Client
client = Client("abc123")
client.newMonitor("coder100", "coder100.exe")
while True:
  votes += 1
  vanilla += 1
  howDareYouNotPublishThisOnPyPi += 1
Warhawk947 (552)

@Coder100 also vanilla python is python with no dependencies, or packages

sugarfi (626)

@Coder100 just like vanilla JS - no external libraries

RohilPatel (1534)

I thought it was a flavour of Ice Cream @Warhawk947

RohilPatel (1534)

Oh, I thought u go to vanillaicecream.com @Coder100

sugarfi (626)

don't use camelCase in python! NEVER CAMELCASE! I REPEAT: NEVER USE CAMELCASE IN A PYTHON PROGRAM! CAMELCASE IS NOT FOR PYTHON! NEVER DO THIS! cool project, by the way.

Warhawk947 (552)

@sugarfi also thanks for upvote

sugarfi (626)

@Warhawk947 no problem, just try to use snake_case

Dart (1185)

@sugarfi CamelCase is easier tho

sugarfi (626)

@Zexogon but you don't use it in python.
From PEP 8:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Variable names follow the same convention as function names.

mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.

sugarfi (626)

@Warhawk947 Python Enhancement Proposal, basically just a guide for writing good Python