Python URL shortening (Python short address)

Source: Internet
Author: User

Alas, I haven't written a blog for a long time. -- Not famousProgramEmployee

Today, we will discuss URL shortening, that is, short address. As the name suggests, the server will shorten the URL. by querying the short address, the server will provide 302 jump to the destination address.

There are many methods for ing between Long and Short addresses. I found there are two types: MD5 sampling, unique ID + base62. I chose the latter. Why? There may be many reasons, maybe no reason.

Python has two ready-made class libraries, short_url (without dB, only ID <-> base62, minimum-digit parameters are generated, and the database is optional. nosql is generally selected ), the other is shorten (which can be stored in redis or memory ).

In addition, you can also use the short address service provided by a third party. This is too much. Many of them provide free APIs, So Google.

P.s. I want to know the short address technology because of the QR code. To generate a QR code that is easy to distinguish, the information contained in the QR code cannot accommodate long addresses.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.