This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""The converter module is used to convert a number into a padless base64 string and back. | |
Padless base64 are used for short urls: http://www.mydomain.com/MTQy for instance. | |
Base64 strings are normally organized by groups of 4 characters and right padded if necessary with = | |
Padless base64 means that = characters are removed""" | |
import base64 | |
def encodeB64Padless(number): | |
"""Encode an integer into a padless base64 string""" | |
return base64.b64encode(str(number)).replace("=", "") |
NewerOlder