Esempio n. 1
0
def pad(s, destination_size=None):
    """Pad a string using different whitespace characters to stop Twitter
    from thinking two tweets are the same.

    Will try to add 10% whitespace to the string.
    """
    if not destination_size:
        destination_size = min(len(s) + max(int(len(s)*0.1), 5), 140)
    padding = ''
    for i in range(len(s), destination_size):
        padding += Alphabet.random_whitespace()
    return s + padding