Created
June 13, 2020 18:56
-
-
Save ThisIsNoahEvans/dbee2c8dcfe691e013b884f70523a2f5 to your computer and use it in GitHub Desktop.
Link shortener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
longLink = input('') | |
res = requests.post('https://api.short.cm/links', { | |
'domain': 'go.itsnoahevans.co.uk', | |
'originalURL': longLink, | |
}, headers = { | |
'authorization': 'API' | |
}, json=True) | |
res.raise_for_status() | |
link = res.json() | |
link = (link['secureShortURL']) | |
print(link) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment