Member-only story

URL Shortener using Python

We will discuss and learn how to use various Python APIs to shorten URLs with only a few lines of code.

Kumar Shubham
Towards Data Science
5 min readNov 13, 2020

Photo by Obi Onyeador on Unsplash

Hello Readers! So, you would have seen short URLs used in various places (social media, websites, messaging platforms etc.). Short URLs are easy to remember or type, so they are very popular. No one loves long URLs and so the need to shorten lengthy URLs often comes to us.

You would have personally used various URL shortening services online, and they all do the job well! Even Google forms, LinkedIn etc., shortens the URLs for ease of use. So, it is a widely used thing on the internet.

So, have you ever thought of or tried to make your own URL shortener? Hopefully, there are many libraries and APIs available to help us do the same programmatically without the need to visit any website and use anyone’s service.

We can write a program in Python language for our needs. Then we can give a long URL as the input, and we would get short URLs as output, that too in very few lines of code. Is not it exciting? Using various APIs does it very easily without digging into complex topics.

So there are various APIs available for doing this job, so let’s have a look at some of the APIs and let’s implement them and see how we can use them to…

Published in Towards Data Science

Your home for data science and AI. The world’s leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.

Written by Kumar Shubham

SDE @ Wells Fargo | Ex-SWE Intern @ ByteLearn | Student @ IIT BHU | Web Dev | DSA | https://www.linkedin.com/in/shubham1710

Responses (1)

What are your thoughts?