Shortening URLs using the bitly API

Our users will not want to type in the long URLs that we currently provide for calling a waiter to their table. We'll now look at using the bitly API to create shorter equivalents of the URLs that we've already created. The shorter URLs, which can be typed into address bars (especially on mobile devices) more easily, will then be shown as being associated with the corresponding tables instead of the longer ones we have now.

Introducing Bitly

The premise behind Bitly—and many similar services—is simple. Given a URL of arbitrary length, the service returns a shorter URL of the form bit.ly/XySDj72. Bitly and similar services normally have very short root domains (bit.ly is five letters), and they simply maintain ...

Get Flask By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.