- Get Access Token, you need to create an account on TinyURL and obtain an access token from the TinyURL settings.
- Replace
YOUR_ACCESS_TOKEN
in theheaders
dictionary, replaceYOUR_ACCESS_TOKEN
with your actual access token. - Run the script.
- You must login in to the TinyURL website using your email address.
- Log in using your email address and visit api settings.
- Give the token a name you like and create your token.
Let's say you have the following long url : https://www.example.com/this-is-a-very-long-url-that-needs-to-be-shortened
, when you run the script with this long url, it should return a shortened url link : https://tinyurl/random_alpha_number