tinyurlpy/tinyurl.py

14 lines
355 B
Python

import requests
import sys
if sys.argv < 2:
print "[*] not enough stuff"
sys.exit(1)
def tiny(key, url):
req = requests.get("http://bhh.sh/api/v2/action/shorten?key=%s&url=%s&is_secret=true" % (key,url))
if req.status_code == 200:
print req.content
else:
print "oops!"
sys.exit()
tiny(sys.argv[1], sys.argv[2])