Gotcha: The Story
It all started on a random Friday afternoon. Bored, I decided to check DevPost to see of any available or open Hackathons to compete in. I came along this Hackathon with the goal to create anything, no matter how easy or stupid. Then Gotcha was made.
What I learned
Nothing.
Here is the entirety of the code, with comments:
# must import requests to make requests...
import requests
# function declaration for getting ip
def get_ip():
# we will try this:
try:
response = requests.get('https://httpbin.org/ip') # classic and often used service, we want to use
data = response.json()
ip_addr = data.get('origin')
return ip_addr # return the ip if everything worked
# we tried except it didn't work, raise error
except requests.RequestException as error:
print(f"ERROR ALERT WEE WOO WEE WOO: {error}")
return None
# variable containing ip by calling above function
ip_address = get_ip()
# if ip exists print, otherwise print that it didn't work
if (ip_address):
for i in range (0, 1000000):
print(f"Your IP: {ip_address}")
else:
print("WOMP WOMP WE'RE STUMPED :(\n")
Log in or sign up for Devpost to join the conversation.