repl.it
@MarcusWeinberger/

repl-bounce-back

Python

ヾ(*ФωФ)βyё βyё☆彡

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import requests, sys

r = requests.get('https://httpbin.org/ip') # get our public ip
j = r.json() # get the json data
origin = j['origin'] # parse

if ' ' in origin: # multiple ips, dunno why it does this sometimes
    ip = origin.split(', ')[0] # usually the same IP anyway
else:
    ip = origin

print("Public IP: "+ip)

new_r = requests.get('http://'+ip)
sys.stdout.buffer.write(new_r.content) # ヾ(*ФωФ)βyё βyё☆彡