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.